JSFiddle - React, Tailwind, and code Playground
HTML
<div class="blind">
<div class = "wrapper">
<div class = "main">
I'm your div with an aspect-ratio of 1:1!
</div>
</div>
</div>
CSS
html, body, .blind {
height: 100%;
width: 100%;
}
.blind {
left: 0;
position: fixed;
text-align: center;
top: 0;
}
.wrapper {
margin: auto;
width: 50%;
display: inline-block;
position: relative;
}
.wrapper:after {
padding-top: 100%;
display: block;
content: '';
}
.main {
position: absolute;
top: 0; bottom: 0; right: 0; left: 0; /*fill parent*/
margin: auto;
background-color: rgb(0, 162, 232);
}