3 ms·
I'm sorry but this is nonsense. When you have an img tag in an html document, and that image takes a while to load and has no pre-set width and height, guess w
by stormbrew 6y ago
I'm sorry but this is nonsense.
When you have an img tag in an html document, and that image takes a while to load and has no pre-set width and height, guess what: the document renders fine and everything else adjusts when the image is finally loaded and its size is known. There's really no reason at all that a <vcenter>ed element couldn't be vertically centered at all times within its containing box, even as its containing box changes size, except a stubborn and dogmatic unwillingness to accept that web pages aren't magazine layouts.
It would be more accurate to say that HTML is progressively rendered. As information comes in, boxes move and change size and eventually settle in their positions.
- goto11 6y ago> everything else adjusts when the image is finally loaded and its size is known Yes, this is called reflow. At the time <center> was introduced, browsers did not support dynamic reflow (except by re-rendering the whole document from the top). For example tables had to be fully loaded before they would be rendered, and the same would be the case for a hypothetical <vcenter> element. <center> on the other hand can be progressively rendered without requiring reflow. My point is just that vertical centering requires a more complex layout model than horizontal centering.
- unabst 6y agoAnd my point is regardless of how complex something is, unless it's impossible, you can just give the thing a name and hide the complexity under the hood. Imagine if this just worked since html1: <div center vcenter>centered</div> And this since css1: <div style="align:center; vertical-align: center">centered</div> Why are we still talking about how to vertical align elements in 2020? That's the question. Having to discuss history as an excuse to why anything is, is a symptom of the problem.
- stormbrew 6y ago> At the time <center> was introduced... ... CSS didn't even exist yet. I don't think anyone is suggesting that vcenter or something like it should have existed at that time. The point is that it could have certainly been introduced by the time css came around and started handling more than basic text styling. It's been over two decades since that condition held. The "more complex layout model" has been here a long time.
- Izkata 6y ago> ... CSS didn't even exist yet. > I don't think anyone is suggesting that vcenter or something like it should have existed at that time. Uh, this subthread started with exactly that question: > It boils down to the simple fact that intuitively when we've had <center> forever, why couldn't there have been a <vcenter> from the beginning? Not even broken, it never existed. It's as if we're being told, "horizontal centering we'll handle, but vertical centering is for you to figure out". Err, why? And figure out based on the tags and attributes provided. Like, they implemented the puzzle but not the solution.
- stormbrew 6y agoI mean, sure, I guess you could take it as literally as "in tim berners lee's original browser version" but frankly, CSS and the ability to reflow the document is so old at this point that getting anal about it not being literally there since the beginning of the web is just silly. Have perhaps a little bit of charity and assume that what was meant there was "since it was possible".
- unabst 6y agoI mean, all the comments I got were not about my main points at all. "No you should do this because of that" is not a valid argument when both "this" and "that" only exist because you created them. If vcenter was part of the original spec, we would have it because the browser publishers would have made sure they fulfilled the specs. We have yet to have it. We are being told valign is a complex feature, and we just accept it. But you should always model your specs based on use case, because that's who you're serving. Anything less than that is ego and dogma driven development. And to me, the most disappointing and damning evidence was that w3c does not even author their own web site. They are not users. https://news.ycombinator.com/item?id=24596769 https://news.ycombinator.com/item?id=24596769 Being from MIT, I could only imagine how fun a student driven implementation effort could be, and they'd do it for free. I was not alone in 1999 building web pages in an Athena cluster. Not sure why writing on HN is so often a negative experience. Not sure why I keep doing it.