JSFiddle - React, Tailwind, and code Playground

HTML

<div class="modal">
    Aspect is kept.
</div>

CSS

.modal {
    position: absolute;
    height: 0px;
    width: 80vw; /* Use 80% of viewport width */
    height: 45vw; /* use 45% of viewport Width so 16:9 ratio */
    max-height: 100vh; /* limits the height to not exceed viewport height */
    max-width: calc(100vh * 16/9); /* Added this to presever 16:9 ratio when viewport is larger */
    background-color: #F00;
    margin: auto;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}