Re:Firefox 66.0 Aims to Reduce Online Annoyances
by onion2k on Tuesday March 19, 2019 @11:08AM
(#19431487)
Aspect Ratio is coming in CSS4. https://www.smashingmagazine.com/2019/03/aspect-ratio-unit-c...
Re:Firefox 66.0 Aims to Reduce Online Annoyances
by DamnInteresting on Tuesday March 19, 2019 @11:26AM
(#19431686)
This pleases me.
Re:Firefox 66.0 Aims to Reduce Online Annoyances
by lewiscollard on Tuesday March 19, 2019 @05:31PM
(#19436163)
You (or others) may or may not know it is already possible in CSS as it is. To force 16:9:
.DamnInteresting {
position: relative;
display: block;
}
.DamnInteresting::before {
content: '';
display: block;
/* 16:9 shim! */
padding-bottom: 56.25%;
}
.DamnInteresting img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
Ugly, but it's easy to make a mixin (or similar) if you're using a preprocessor!(The ::before element isn't stricly necessary; the padding can go on the .DamnInteresting element directly - just make sure .DamnInteresting is wrapped in a containing element of your desired width and you can even use inline styles for the padding shim.)
(Edit: a word)
Re:Firefox 66.0 Aims to Reduce Online Annoyances
by aargh_aargh on Tuesday March 19, 2019 @11:19AM
(#19431606)
To be honest, if you know one dimension and the aspect ratio, you're more likely to know both dimensions.
Edit to add: Or maybe it would be better to just have the ability to lock the ratio, such as: