JSFiddle - React, Tailwind, and code Playground
by abhitalks
HTML
<div id="container">
<div id="div1"></div>
</div>
CSS
div {
border: 1px solid blue;
}
#container {
background-color: #ccc;
width: 400px; height: 400px;
position: relative;
}
#div1 {
background-color: yellow;
width: 200px; height: 200px;
position: absolute;
top: 10px; left: 10px;
}
JavaScript
x = $('#div1').position().left + 100;
y = $('#div1').position().top;
$('<div>').appendTo('#container').css({'position': 'absolute', 'top': y, 'left': x, 'width': '100px', 'height': '100px'});