JSFiddle - React, Tailwind, and code Playground

by Bart Kalisz

HTML

<div class="wrapper">
  <div class="content">
    <div class="text">
    </div>
  </div>
</div>

CSS

* {
  box-sizing: border-box;
}

html {
  font-size: 1vw;
}

html, body {
  width: 100%;
  height: 100%;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  margin: 0;
}

.wrapper {
  flex: 1;
  width: 100%;
  height: 100%;
  max-height: calc(10 / 16 * 100vw);
  max-width: calc(16 / 10 * 100vh);
  padding: 5rem;
  background: lightgray;
}

.content {
  width: 100%;
  height: 100%;
  padding: 5rem;
  background: darkgray;
}

.text:before {
  font-size: 2rem;
  content: "Screen ratio matches container ratio";
}

@media (max-width: 159.9vh) and (min-height: 62.5vw) {
  .wrapper {
    background: blue;
  }
  
  .text:before {
    content: "Screen height extends max container height";
  }
}

@media (min-width: 160vh) and (max-height: 62.49vw) {
  html {
    font-size: 1.6vh;
  }

  .wrapper {
    background: green;
  }
  
  .text:before {
    content: "Screen width extends max container width";  
  }
}