4 ms·
I'm out of the web development game, but in my day it was still quite possible to vertically center text and icons consistently. You just had to notice it was b
by karaterobot 3y ago
I'm out of the web development game, but in my day it was still quite possible to vertically center text and icons consistently. You just had to notice it was busted in the first place, and then go in and fix it. It's not a technological problem, or at least not a non-trivial one.
The problem is that, if it's off by a couple pixels, the front-end engineer may not notice it, and the designer may not even look at it. Or, if they do notice it, they think "do I want to file a bug report right now, or do I want to work on my own ticket right now?" Having worked in both roles, this is my experience anyway.
I agree that there's no consistent way to center things that always works, no matter what, without anybody thinking about it or paying really careful attention. I think we prioritize solutions with those performance characteristics, which is a separate problem of even greater magnitude.
- crazygringo 3y agoNo, this was never possible, not in web development. You could do it in one browser on one OS, but then they could be off on another browser on another OS. It's absolutely a technological problem because pixel-perfect rendering and alignment is not part of the HTML/CSS specs, when it comes to how fonts get drawn. The only way to actually get it perfect is to do browser and OS detection and then hand-code a bunch of manual offsets that you keep up to date. And obviously that would be insane.
- saurik 3y agoI don't think you have to have a "pixel-perfect" rendering system to support centering things correctly?
- anonymoushn 3y agoIf you don't, you'll be off by 1px?
- saurik 3y agoSo, I would use the term "pixel-perfect" to mean that the person making it can target some specific layout, choosing all aspects such as the sizes and fonts and exact colors and such. However, even without that, you can still say "I want this to be monospaced red on a blue background and larger than usual" and all of those properties can vary but hopefully something should happen that preserves at least some of that intent? The properties of vertically centering something inside of a table cell to me are not part of a pixel-perfect layout system, and yet I feel like my user agent is doing a pretty poor job if it doesn't have at least some sane strategy for this, and to the extent to which there are multiple different good ways to do it I hate that it seems to default to "if I can't select a good way I'll just use a bad way" in its zeal to refuse to expose multiple definitions of "centered" to the web developer (and again: I don't think being able to say "try to center this in a way useful for numbers" is part of "pixel perfect").
- anonymoushn 3y agoYou're right. The browser should just expose this capability and get it right. Recently I've learned that even the parts of OpenGL which are fully specified give wrong results on ubiquitous hardware+driver combos at the pixel level. The commonly proposed solution is "instead of using the transforms and blending exposed by OpenGL, do it correctly yourself in a shader." Gosh.
- karaterobot 3y ago> The only way to actually get it perfect is to do browser and OS detection and then hand-code a bunch of manual offsets that you keep up to date. And obviously that would be insane. That's exactly what you do. And that's what I'm saying: the view that the product we're making is not worth doing one-off fixes for, that we need one solution for everything. No other trade has this delusion about everything being a perfect system you can control from a single commanding height (a component library, for example). Even other forms of programming, like game development, don't pretend you can avoid doing one-offs. Just web development, as far as I can tell.