Closed peiche closed 5 years ago
Hi Paul, do you have an example of the 21:9 ratio in use? is it a 'popular' ratio, or is it a ratio you've found useful in your projects?
I haven't used it myself, but it's the ratio used in widescreen formats. You can find plenty of videos in 21:9 on YouTube, for example.
Hi @peiche thanks for the additional info. We have added the option to set custom ratio values using a Sass list (as you suggested). Here's the commit with the changes: https://github.com/CodyHouse/codyhouse-framework/commit/2b23a928d9c66f863b9bb80e6b09742faedfda7d
By default, the framework includes only the 4:3 and 1:1 class (with the 16:9 as default), but you now have the option to define a custom list of ratios overwriting the default. Here's how you can do that: https://codyhouse.co/ds/docs/framework/utilities#media-wrapper
This way you can add custom ratios if and when you need them.
Thank you for your suggestion and the code! I'm closing this now. If you have any other feedback, feel free to reopen it. Cheers!
Added a Sass list of aspect ratios. This list is iterated over to generate utility classes for each.
This is takes inspiration from the way Bootstrap generates aspect ratio classes, with one difference. Instead of using the Sass
percentage()
function, I'm usingcalc()
directly. Browser support is good; thanks to thepostcss-calc
plugin, the fallback stylesheet outputs the percentages directly.