[ Home / About / Contact / WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]

/resp/ - Responsive Design

Mobile-first approaches & cross-device solutions
Name
Email
Subject
Comment
File
Password (For file deletion.)

File: 1795803947179.jpg (243.44 KB, 1024x1024, img_1795803938470_ww2qtckd.jpg)ImgOps Exif Google Yandex

89cc7 No.2450

I'm tired of seeing people use padding-top hacks for aspect ratios anymore. It's so messy and makes the DOM harder to read when you have to wrap everything in a dedicated container just to keep the height from collapsing. Modern browsers handle the aspect-ratio property perfectly fine now, so there's no reason to stick with the old way. Just set it directly on the video or iframe tag.

iframe {width: 100%;aspect-ratio: 16 / 9;}


It keeps the layout stable without that extra wrapper div cluttering up the component. It's much cleaner for anyone trying to maintain the markup later. Just don't forget to set a width or it'll default to the intrinsic size.


[Return] [Go to top] Catalog [Post a Reply]
Delete Post [ ]
[ Home / About / Contact / WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]