3 ms·
Every few years I have to look up what the current state of the art is for centering something in CSS. I've so often been shocked that there still wasn't someth
by xnx 4y ago
Every few years I have to look up what the current state of the art is for centering something in CSS. I've so often been shocked that there still wasn't something as simple as <center>. Similarly, I couldn't believe how long it's taken to get something as useful as tables for layout.
- fwlr 4y agoI also used to be annoyed by how long it took to get “basic useful functionality” for some use case in CSS. Over the years I have mellowed as I recognized it simply takes a long time to converge on what functionality is actually desired, and then what systems need to be in place so you can request that functionality in the most obvious location in your code (e.g. it turns out we really want to put the request for centering on the element to be centered, not the parent) along with figuring out the truly minimal, truly necessary information to carry out that functionality — and then further still to implement those needed systems in all major browsers. It’s just a long and incremental process by its nature and we probably can’t do much better than that. Ironically, the fact that the state of the art changes every few years is evidence that this process, though slow, does work reliably well.
- eurasiantiger 4y ago<center> is effectively <div style=”text-align: center;”> <span>centered element</span> </div>
- c-smile 4y agoNot so easy, at least: <span style="display:inline-block">centered element</span> But in general <center> still cannot be 100% expressed by CSS means.
- deleted 4y ago[deleted]
- bazoom42 4y ago<center> just centered text horizontally. This have been supported by CSS from the beginning. The CSS property display:table gives you the same layout power as tables.