Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


Every article about CSS centring is about centring horizontally and vertically. <center> only does horizontal.


The web development "community" seems to love reinventing increasingly complex solutions.


No 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.


<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/ce...


text-align:center does NOT entirely replicate <center>. And has been a source frustration for many.


that's fair, but <center> and this post are still not equivalent at all.


Nah, that's just the javascript nuts. We're much saner in CSS land.


You 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: