It’s “class”, not “CSS class”

Sometimes when people talk about class names in HTML, they mistakenly call them “CSS classes”. I’m guessing that most of the time this is something they have picked up from server side development frameworks that use “CssClass” properties to specify the value of class attributes. Another possible source is content management systems that use “CSS Class” in their editor interfaces.

I wouldn’t see a problem with this if the class attribute in HTML and XHTML had no other purpose than letting the author apply CSS rules. But it does. Deciding which elements a JavaScript function should affect, for instance. It can be a bit confusing to talk about “CSS classes” when they won’t be used with CSS.

So please try to refer to values of the HTML class attribute as classes, class names or HTML classes instead of CSS classes.

This post is a Quick Tip. Background info is available in Quick Tips for web developers and web designers.

Posted on February 12, 2009 in Quick Tips, CSS, (X)HTML