JSFiddle - React, Tailwind, and code Playground
HTML
<div id = "red">
<div id = "blue"></div>
</div>
CSS
#red{
background: red;
width: 200px;
height:200px;
}
#blue{
width: 20px;
height:20px;
background:blue;
}
JavaScript
// Run initially on page load
$(document).ready(function() {
resize();
});
// Run when resizing the window
$(window).resize(function() { resize() });
// Handle the resize
function resize() {
$('#red').width($(window).width());
$('#red').height($(window).height());
$('#blue').width($(window).width() * 0.1);
$('#blue').height($(window).height() * 0.1);
}