News for hackers. Stuff that matters.
Re:Firefox 66.0 Aims to Reduce Online Annoyances by DamnInteresting on Tuesday March 19, 2019 @11:03AM (#19431426)
It would be nice if we could have a ratio rule in CSS for all block elements, so adjusting one dimension would automatically alter the other, preserving the ratio at all screen sizes. e.g.:

    width: 2000px;
    max-width: 100%;
    ratio: 16/9;
Of course this gets tricky when width and height are both specified and they don't match the given ratio, but that just means that one needs to always override the other.

Edit to add: Or maybe it would be better to just have the ability to lock the ratio, such as:

    ratio: fixed;
Re:Firefox 66.0 Aims to Reduce Online Annoyances by onion2k on Tuesday March 19, 2019 @11:08AM (#19431487)
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.
Re:Firefox 66.0 Aims to Reduce Online Annoyances by runarberg on Tuesday March 19, 2019 @11:51AM (#19431970)
Well, the thing is with `width: 9000px; max-width: 100%;` is that you know neither. And it forces people to use silly things like `padding` to maintain aspect ratio in e.g. embedded videos.