Everyone expects it to be as simple as <div centered> and everyone is surprised it isn't. That's a pretty universal experience in web development.
Everyone expects it to be as simple as <div centered> and everyone is surprised it isn't. That's a pretty universal experience in web development.
For example, what does `<div centered>` do when there are two children? And what do you do when you want the opposite behavior?
Force me to use the advanced option or to wrap the two children in a centered container? I am certain this wouldn't cover many, many edge cases, but they are called edge cases for a reason.
Edit: People can complain about tables etc being the wrong approach all they like, in the end those examples are only proof that the proper way could be at least as simple for the average case.
Now show me how you change spacing/centering behavior with the proposed <div centered> and you'll finish out the point of my previous comment.
Hell, I would argue that centered table contents gave people what they wanted most of the time, and if it didn't you could fix it by adding more tables. Tables composed quite nicely and gave you something if you just laid down a table and some TDs.
Flexbox doesn't scale down the way tables do. I have to have both the container and elements inside that container and think about the ramifications of all of that. It's minimum level of complexity is a higher floor than most of the HTML specification.
That's not to say it's the wrong solution for the problem; I think a case can be made that the problem itself is irreducibly complicated. But that's why I say it feels like using an elephant gun relative to much of the rest of the spec; I have a "read my mind" option for bold and italic.
I don't think I ever wanted things centered relative to anything other than the direct parent, no matter what that is. I am sure some cases need it differently, but I don't see why those should prevent intuitive defaults.
> A simple attribute cannot work
Can it not work at all or just if one insists on covering 100% of cases on the internet with a single comprehensive option? I'm not an expert in this so I'm not sure, but I've seen a lot of software center items automatically and it worked quite well because they didn't assume by default that I might push the boundaries of design to new heights at any moment.
In today's web landscape using tables to center categorically fails to work in many scenarios that will work with flexbox.
The fact it took over two decades to surpass is not a compliment at all. Considering "internet time" (first identified in the 90s), it's a disgrace.