<div>I'm 16:9</div>

<style>
div {
  background: lime;
  --aspect-ratio: 478/239;
}</style>
html {
  background: #999;
}
body {
  width: 300px;
  background: white;
  padding: 20px;
}
div {
  display: grid;
  place-items: center;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://assets.codepen.io/3/aspecty.js