JSFiddle - React, Tailwind, and code Playground
HTML
<div id="main"></div>
<input id="check">
CSS
#main {
text-align: center;
}
.new {
width: 120px;
position: relative;
margin-top: 10px;
background: lightgray;
}
.new > img {
width: 100%;
display: block;
}
#check {
position: absolute;
top: 10px;
right: 10px;
}
JavaScript
var main = $('#main');
var check = $('#check');
var newDiv = $('<div>', {class : 'new'});
newDiv.append('<img src="http://cs623117.vk.me/v623117424/1f53f/d4AjcO1YcsQ.jpg">Some text');
main.append(newDiv);
check.val('<-height: ' + newDiv.height());