This content originally appeared on Christian Heilmann and was authored by Chris Heilmann
The CSS aspect-ratio property is pretty amazing. You can define a ratio of width to height and it will resize the element accordingly.
You can try it out in this pen :
See the Pen
CSS aspect ratio is awesome! by Christian Heilmann (@codepo8)
on CodePen.
Where this shines is videos, image content and embeds. No more hacks with relative positioning and percentages. Browser support is green all over, so, like me, it makes sense to upgrade your CSS habits.
This content originally appeared on Christian Heilmann and was authored by Chris Heilmann
Chris Heilmann | Sciencx (2023-04-20T06:34:31+00:00) Upgrading our CSS habits: aspect-ratio. Retrieved from https://www.scien.cx/2023/04/20/upgrading-our-css-habits-aspect-ratio/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.