Sunday, October 31, 2010

HTML centering is crappy

There, I've said it. All you Web Designers know it too, even those of you who've spent your short careers proclaiming the goodness of all things CSSey.

Look, I just HATE that in order to center a DIV in HTML I have to write something like the following:

#mydiv {
width: 500px;
height: 400px;
margin-left: auto;
margin-right: auto;

I mean, does anyone still think this kind of garbage is good enough? SERIOUSLY?

I've just had it with seeing otherwise intelligent people drinking the cool-aid. Down that path lies madness.

Look, here's the thing in a nutshell: the designers of the original CSS specs punted with formatting. They knew they had a good thing going by riding on the backs of nascent Web browser vendor's products, and just tried to jury rig something that would kind of sort of fit what was already there.

After all, if it ain't broke, don't fix it.

The problem was not that it was broken -- even with decades of industry precedents, HTML formatting was a giant experiment. The problem was not that they didn't fix it: creating novel markup that works for a large audience and then inventing formatting models for that markup that make sense, is not a trivial task.

No, the real problem is that Web Designers continue to talk up CSS as if it were the best thing since sliced bread, even while pumping out ill-conceived code that fossilizes the worst parts of the HTML layout model.

Centering DIVs using margin: auto is idiotic. As professionals, we should demand that our tools and languages directly express the intended functions, not work only as accidental side effects.

Maybe it doesn't mean much when we're just talking about some marketing fluff, but not everyone making HTML is selling something. Today's products are tomorrow's garbage, but our memories, our stories, and our learning... this our legacy people! It aught not to be entrusted to languages that don't say what they mean.

No comments: