Aspect Ratio Media Elements and intrinsicsize

If you need an aspect-ratio sized

(or any element that can have children), you can do it. Perhaps the cleanest way is a custom-property-sized pseudo-element that pushes the correct minimum height through padding-based-on-width.
But media elements like <img> don’t have children. The <video> tag isn’t self-closing, but when it is supported (almost always), the content of it is replaced with a shadow DOM you don’t control. Besides, these are the only two elements that “size to an external …
The post Aspect Ratio Media Elements and intrinsicsize appeared first on CSS-Tricks.

Link: https://css-tricks.com/aspect-ratio-media-elements-and-intrinsicsize/