3 ms·
> Why would you have different default behaviours if you have one of the dimensions set but not the other? Basically: be there or be square (fill up the space
by eyelidlessness 5y ago
> Why would you have different default behaviours if you have one of the dimensions set but not the other?
Basically: be there or be square (fill up the space or not, your choice), but if you show up there’s a dress code (you can only fill up the space as specified).
> Oh look, lets define a new property and call it aspect ratio, and then lets ensure it doesn't maintain an element's aspect ratio if you have content that is going to overflow if you specify a width. This is what drives me mad about css, it's gotchas all the way down.
There’s a lot I don’t like about CSS, but this is just the spec avoiding undefined behavior. No one is using aspect ratio for unbounded text in practice, they’re using it for media or a design system. Knowing how it behaves for edge cases is much better than having a protracted battle for years while vendors sort it out, with different assumptions in the wild.
- jontro 5y agoIf you set overflow: hidden it seems to do the trick on chrome at least
- eyelidlessness 5y agoRight. As one would expect.
- eyelidlessness 5y agoTo emphasize this point, the alternatives would be ridiculed: - overflow is assumed by default and constraining it is a whole bunch of necessary compromises, so my element maintains an aspect ratio but its content is overlapping siblings with the same aspect ratio. What the hell were they thinking? - my element with 16:9 aspect ratio and the full text content of Moby Dick serialized as JSON was so wide my browser ate all my memory and swap, locked my computer up forcing a hard reboot
- torgard 5y ago> full text content of Moby Dick serialized as JSON Reminds me of when YouTube added a new comment system, but didn't specify a max length, and rendered the full text by default. People were spamming the Bible in comments.
- r_hoods_ghost 5y agoYou could instead just define the edge case behaviour so it is sane and consistent, e.g Text always overflows unless otherwise specified, or text is always clipped, rather than "lets stop the thing doing what it says it's doing". I swear the CSS spec considers "insane by default" To be a feature.
- frosted-flakes 5y agoWhat you propose is insane by default. Clipped or overflowing text is almost never what you want.
- layer8 5y agoThe problem is that CSS is not (and continues not to be) designed to minimize such conflicting specifications, and does not provide a unified, explicit and systematic way to control conflict resolution.