HTML Made Special

Using class Attributes

The class attribute is a bona fide extension point in HTML, and as such a candidate for vernacular specification. In fact, it is an approach that has been used in Microformats as well as in how PRISM has been translated to HTML.

One advantage is that this approach ties directly into the CSS system. It should be noted however that today’s browsers are able to match on arbitrary elements and attributes, which makes this less appealing. Since class is the integration point with CSS, using it for semantic purposes also means that you may conflict with the preferred CSS practices of some of your users. A CSS class is essentially a big global variable; if you start having too many code can become harder to manage.

↖︎ Back to list