5 ms·
Man, I wish I knew. Any language is a way of encoding the biases and preferences of a language designer. It makes some things easy and some things hard, so it
by jfengel 6y ago
Man, I wish I knew.
Any language is a way of encoding the biases and preferences of a language designer. It makes some things easy and some things hard, so it nudges you do to things that fit their intended work flow. Learning a language is like getting inside the mind of the designer.
I've been completely unable to do that for CSS. Whoever designed CSS layout, they don't think like somebody who designs print pages (or we'd have had "grid" decades ago). They don't think like a programmer, or we'd have a rigorous algorithm we could study (and that browsers could implement consistently).
Of course it's designed by committee and evolved over time, so there's really multiple different paradigms within it. That just makes it harder, but even if I focus on one, I can't suss out what it was they were thinking. I'm guessing that each one was designed to be easy to implement on some extinct browser engine.
So my way of learning CSS is to take a first pass, and then stab manually at settings on the browser's inspector until it's close enough. Then I try to remember what worked until I can copy it into my CSS sheet, then re-render and repeat the process.
- shp0ngle 6y agoYeah, this has been my experience too. Sometimes I think there is some big idea behind CSS layout logic (not the actual cascading, that one is pretty clear) that I am missing, but maybe not.
- jfengel 6y agoYeah, I feel the same way. "Surely, surely it can't be this bad." Yeah, it is. The closest thing I can give you to a pointer is this: https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_Block https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_... https://developer.mozilla.org/en-US/docs/Web/CSS/position https://developer.mozilla.org/en-US/docs/Web/CSS/position It's kinda vaguely rigorous and authoritative, and explains some of the more bewildering and arbitrary concepts. I don't actually understand these pages: every time I have a CSS problem I go reread them, and then go back to poking randomly until it looks nice. But maybe they'll help you.
- shp0ngle 6y agoThanks, that is exactly what I have been looking for. Yeah it seems all pretty random and without ryme or reason, but I guess that's the best I can get