Open peiche opened 3 years ago
Hi Paul, we're still looking into this because 1. support is not that great yet (e.g., aspect-ratio is not supported in iOS < v15, which is about 10% according to caniuse), and 2. it would be great if the new classes are somehow 'compatible' with the old ones - not sure if possible. Anyway, this is def on our radar 👍
Hi @sebastiano-guerriero, thanks for the feedback. I just added the fallback again for browsers that don't support the property natively. (Props to CSS Tricks for providing the @supports
logic.)
Hi @peiche! I've run many tests based on your suggestion. Here are the results:
.aspect-ratio-{ratio}
class on the parent of an image/video/iframe. Hence the new, proposed implementation would cause a breaking change..ratio-16\:9 { aspect-ratio: 16/9; }
.ratio-3\:2 { aspect-ratio: 3/2; }
.ratio-4\:3 { aspect-ratio: 4/3; }
.ratio-5\:4 { aspect-ratio: 5/4; }
.ratio-1\:1 { aspect-ratio: 1/1; }
.ratio-4\:5 { aspect-ratio: 4/5; }
.ratio-3\:4 { aspect-ratio: 3/4; }
.ratio-2\:3 { aspect-ratio: 2/3; }
.ratio-9\:16 { aspect-ratio: 9/16; }
In the future, probably the best approach would be renaming the current classes to something like .media-wrapper-{ratio}
and use the aspect-ratio property for the `.aspect-ratio-{ratio}' classes - with no fallback.
Any feedback is welcome.
The
aspect-ratio
property has support across all major browsers. Since CodyFrame v3 has dropped support for IE, I propose it adopts proper aspect ratio implementation, as opposed to the padding hack. Cheers!