Post #1172199
2026-04-12 16:17 UTC
I don't know if there are other clever ways of doing this with pre-2022 technology, but apparently cqw/cqh are pretty well-supported CSS features by now, and with them and calc you can really nicely solve "I want a fixed aspect ratio div that is as big as possible in its container" by simply saying
width: min(100cqw, calc(100cqh * 9 / 16))
Replies (1)
-
@jcreed@mastodon.social 2026-04-12 16:40
ah, CSS "container-type: size;" is also a crucial piece of making this work correctly.