JSFiddle - React, Tailwind, and code Playground
HTML
<div class="wrapper">
<div class="main">
This div has an aspect-ratio of 16:9...
</div>
</div>
CSS
html, body {
height: 100%;
width: 100%;
}
.wrapper {
width: 50%;
display: inline-block;
position: relative;
}
.wrapper:after {
padding-top: 56.25%; /*16:9 ratio*/
display: block;
content: '';
}
.main {
position: absolute;
top: 0; bottom: 0; right: 0; left: 0; /*fill parent*/
background-color: blue;
color: white;
}