5 ms·
I know it's not the trendy thing, but <center> has always done exactly what I wanted without much fuss. Even if it's technically depreciated, it's in such wides
by thekyle 6y ago
I know it's not the trendy thing, but <center> has always done exactly what I wanted without much fuss. Even if it's technically depreciated, it's in such widespread use that no sane browser would ever remove support.
- userbinator 6y agoThe web development "community" seems to love reinventing increasingly complex solutions.
- BenTheElder 6y ago<center> and the solutions in this post are not equivalent ... The HTML center tag only horizontally centers the contents which you can do with the simple CSS: `text-align:center` [1] The examples in this post center horizontally AND vertically. [1]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/center https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ce...
- arn 6y agotext-align:center does NOT entirely replicate <center>. And has been a source frustration for many.
- BenTheElder 6y agothat's fair, but <center> and this post are still not equivalent at all.
- deleted 6y ago[deleted]
- markdown 6y agoNah, that's just the javascript nuts. We're much saner in CSS land.
- Yaggo 6y agoYou probably wrote tongue in cheek, but it's a good point. The fact that there are "JS land" and "CSS land" is one of the problems. There should be better integration between the two, eliminating the need for "hacks" such as replacing stylesheets by JS styling (popular with React, for example). Writing variable-based dynamic CSS is too hard. SASS and other variants don't solve the problem because they are compile-time, not runtime technologies.
- Yaggo 6y agoNo doubt there's overlapping complexity in web technologies (e.g. flexbox and grid), partly because we can't re-invent everything from scratch. Multiple players probably also play big role here, single-vendor technologies are easier to get right. But, often the problems are also non-trivial. The web platform is really diversed, there are user-agents everywhere from mobile phone to smart tv and everything between, with extremely varying input methods (touch, mouse, etc), resolutions, pixel densities, performance, etc. Some of the devices are never updated, running a decade old browser. I don't think any other technology faces similar challenges. Actually it's amazing that things work as good as they do.
- onion2k 6y agoEvery article about CSS centring is about centring horizontally and vertically. <center> only does horizontal.