3 ms·
Yet 15 years later, I still can't specify a width and aspect ratio for an div without some unintuitive nested div hell.
by dheera 4y ago
Yet 15 years later, I still can't specify a width and aspect ratio for an div without some unintuitive nested div hell.
- nailer 4y agoYes you can https://css-tricks.com/almanac/properties/a/aspect-ratio/ https://css-tricks.com/almanac/properties/a/aspect-ratio/
- partiallypro 4y agoExperimental on Safari, so it's unusable of you have a real world project.
- TheAngush 4y agoAre you sure? It seems to work for me. MDN and caniuse agree: https://caniuse.com/mdn-css_properties_aspect-ratio https://caniuse.com/mdn-css_properties_aspect-ratio
- LukeLambert 4y agodiv { width: 640px; aspect-ratio: 16 / 9; }
- dheera 4y ago> But with Chrome and Firefox supporting it behind an experimental flag So basically not supported, and you have to go back to div hell. There should be some future.js file that you can import to make all this stuff just work in older browsers.
- TheAngush 4y agoWhere are you getting that from? It seems to be fully supported: https://caniuse.com/mdn-css_properties_aspect-ratio https://caniuse.com/mdn-css_properties_aspect-ratio I've been using if for months with no issues in cross-browser testing, and I haven't enabled any experimental flags.