JSFiddle - React, Tailwind, and code Playground

by anurag

HTML

<img src="random.png" id="random" />

<br /><br />

<div></div>

CSS

div {
    background-color: #EFEFEF;
    font-family: Monaco, Verdana, Arial;
    font-size: 12px;
    border-radius: 5px;
    box-shadow: 2px 2px 7px #888;
}

div, p {
    border-radius: 5px;    
}

p:nth-child(even) {
    background-color: white;
}

p {
    padding: 10px;
}

p b {
    display: inline-block;
    width: 200px;
    padding-right: 10px
}

JavaScript

var image = document.getElementById('random');

$("div").append(
    html("image.src", image.src),
    html("image.getAttribute('src')", image.getAttribute('src'))
);

function html(label, value) {
    return "<p><b>" + label + "</b>: " + value + "</p>";
}