3 ms·
Alternatively, people are trying to do things with webpages that they really weren't meant for, i.e. CSS is based around document-oriented pages so anything out
by userbinator 6y ago
Alternatively, people are trying to do things with webpages that they really weren't meant for, i.e. CSS is based around document-oriented pages so anything outside of its formatting model becomes more difficult. From CSS 2.1 section 10.3.3:
"If both 'margin-left' and 'margin-right' are 'auto', their used values are equal. This horizontally centers the element with respect to the edges of the containing block."
i.e. horizontal centering is easy because that's a natural thing to want to do in a document, but vertical centering seems to make less sense and is thus correspondingly more difficult.
- JimDabell 6y ago> i.e. horizontal centering is easy because that's a natural thing to want to do in a document, but vertical centering seems to make less sense and is thus correspondingly more difficult. It’s because text wraps horizontally and flows from top to bottom. The width is constrained by the window but the height is defined by the contents of the document. This means that if you are trying to vertically centre something in the document, you need to know the size of the document before you can render its contents, but you need to render its contents to know the size of the document. There’s various ways around this but they all have different trade-offs, hence multiple solutions to the problem of vertical centring in CSS.
- hombre_fatal 6y agoThe web is meant for anything you can build with its tools. That its tools lagged behind what people were building with them is just a reminder that a platform's caretakers have little to do with the creators on the platform. This goes for everything. I built a forum from scratch that miraculously exploded into a community and culture and drama. 15 years later I look at it and realize it happened in spite of me, not because of me. It doesn't even feel like any of it's mine. I'm a groundskeeper. I might have built the scaffolding, but who am I to say what it's for once thousands of people have made that decision for themselves? "No, no, no. The web is for boring documents of <p> and <img>! What are you people building?! The most complicated application I envisioned when I invented HTTP was Encyclopedia Britannica online, and the limits of my imagination must be yours!"
- dgb23 6y agoOh thank you! I very much agree. But I still, as a dev I often feel the urge to keep things simple and wish that I didn’t have to make so many tradeoffs between structure and layout. It’s many little things, workarounds that pile up given a sufficiently complex/bespoke page. And each of them feel a little bit wrong. Especially when I have to „fix“ things via JS, which fortunately almost never happens anymore.