Hacker News new | ask | show | jobs
by JimDabell 862 days ago
Because what people mean by “centring” varies depending on context. You are actually talking about a group of several different behaviours and you don’t always want the same one. So you need multiple behaviours, and you need multiple ways of specifying those behaviours.

The most obvious example: horizontal and vertical centring are different because our writing system has a specific direction it flows in. You can’t just do the same thing for horizontal as for vertical because text doesn’t work that way.

1 comments

This problem was solved literally decades ago with <center>. I appreciate why that HTML tag was deprecated but I also completely sympathise with why people scoff at the complexity of doing the same thing with CSS.
<center> only centers horizontally which has been easy with CSS for years. It only gets tricky when you also want vertical centering.
this blog post and subsequent discussion is literally just about horizontal centring!

I’ve been building websites longer than most (since 1994 in fact) and centring in CSS is definitely not as easy as it was with the <center> HTML. Not even close. If it were, there wouldn’t be this entire discussion to begin with.

I swear the amount of times topics like this come up and yet a small subset of developers, likely Stockholm syndromed into believing things are great, is ridiculous. The sooner people like yourself pull your head out of your arse and realise that the current status quo is unacceptable, the sooner web standards finally mature into something that doesn’t have more footguns than the worst of C and worst of Perl combined.

> this blog post and subsequent discussion is literally just about horizontal centring!

It’s not. Did you read past the first example? It goes into vertical centring from “Centring with flexbox” onwards.

ok, half the article and most of the HN discussion is about horizontal centering. Either way, the point is still valid regardless of what percentage of the article was focused on something that should be trivially discoverable to even the casual web developer.
The <center> element is extremely limited and can’t centre things in most of the ways described by the article.
I agree. However <center> (or rather a hypothetical CSS equivalent) would still more than good enough for a considerable number of common use cases.

It's perfectly reasonable to ask a particularly language to make the easy things easy while still being powerful enough to make the hard things achievable. When it comes to CSS, or even web development in general, that isn't often the case. This discussion demonstrates that point too.

We're long overdue a redesign in my opinion.