JSFiddle - React, Tailwind, and code Playground
by mmansion
HTML
<div id="wrapper">
<div id="div1"></div>
<div id="div2"></div>
</div>
CSS
body {
margin: 0;
}
div {
position: absolute;
width: 100px;
height: 100px;
background: orange;
}
#wrapper {
width: 100%;
height: 100%;
background: lightgray;
}
#div1 {
top: 300px;
left: 200px;
}
#div2 {
top: 100px;
left: 400px;
}
JavaScript
$(window).resize(function() {
$('#div1').css('left', $(window).width() - 300);
});
$('#div1').css('left', $(window).width() - 300);