Pragmatic HTML

2010-03-05

For as long as I've used HTML, for better or worse, I was under the impression that the language (if you want to call it that) was a governing set of rules to be applied where-ever one could, when creating a website. Yesterday, for the first time, I was told otherwise. Apparently I've been missing a huge whopping piece of this whole HTML puzzle all this time! HTML elements should only be used in a pragmatic sense. That means, where they make sense and have some practical usage!

I've had numerous discussions about the ideology of HTML elements. Especially lately, with HTML5 introducing a large collection of the seemingly arbitrarily chosen tag soup, this discussion came up more than once. And now it seems that those discussions could have been prevented with the prerogative of HTML being about applying tags in a pragmatic sense. If only I knew...

I'm a fan of the semantic web. Not a flag bearer or anything, but a fan nevertheless. I'm all for annotating the content you're trying to represent so that machines can also interpret more of it. Think of better search results or even just a research project for the semantic web.

The <time> tag seems to be an excellent example of this. In my opinion, if there's a time tag and you're using anything time-related and you care about semantics at all you should probably wrap such content in the time tag, regardless of it being a specific point in time, a duration or something too generic to point out on a calendar. But not in HTML you don't. Or shouldn't. Only use it when it has a use. When “it solves a problem”. Otherwise ignore it.

Now this might be where I could argue that this is very subjective. Say I want to try and make my content as semantically marked up as it could be, for whatever purpose. Then it solves my problem of trying to accomplishing that. Say I want to turn another website into a semantic web, the other person uses a pragmatic approach so my semantic web will have a _lot_ of holes…

HTML 5 also falls short of that objective simply because there's just the arbitrary set of tags and no (realistic) way of adding new tags, for whatever reason. And yes, I know about micro formats, thanks, it’s not the same.

For instance, there's no <geo>, even though it'd be interesting to add. Imagine that tag wrapped around some geographic location, with the coordinates embedded, and all you have to do is click on it to get a little map showing you the bounds given in the attributes... how cool would that be? But no. There was no use for it, no need for it and it wouldn't "solve" anything. So it's not there.

Meh.... well anyways. HTML is meant to be used pragmatically, not theoretically semantically, just practically. Remember it. Believe it. Apply it.