[CSS3] Use CSS Variables to Maintain the Aspect Ratio for an Element

section img {
  --aspect-ratio: calc( 4 / 3);
  --height: 30vmin;
  --width: calc(var(--height) * var(--aspect-ratio));
  height: var(--height);
  width: var(--width);
}
原文地址:https://www.cnblogs.com/Answer1215/p/13676370.html