Archive for the ‘Uncategorized’ Category

A class of its own

Friday, February 13th, 2009

Roger Johansson, author of the excellent 456 Berea Street blog, wrote a post about how classes in HTML and CSS are frequently called “CSS Classes“. I thought I’d reply, but Roger has the blog commenting turned off nowadays, so I do it here instead.

I think it’s really good that Roger points out that the class=”" attribute is not all about CSS. Using CSS classes is really convenient in Javascript, both to indicate elements that should be processed and to show states. It can even be used to carry data used by scripts. At least until we start using the data-* attribute in HTML 5.

But HTML/CSS classes is stillsomething wholly different from the classes used in many programming languages, inlcuding Javascript where it is a reserved keyword (Yet another reason why we see property/variable names like cssClass).

in the world of XML/HTML/CSS/JS/JSON, I think I prefer class attribute.