Month: October 2005

Class attributes are about more than styling

When people talk about microformats, they often have the same bit of confusion about the class attribute; it is often referred to as a “css class.”

I’m not criticizing anyone here, I just want to point out that there’s some confusing regarding the class attribute.

In the HTML 4 spec (from which XHTML is derived), classes are defined to have these purposes:

The class attribute, on the other hand, assigns one or more class names to an element; the element may be said to belong to these classes. A class name may be shared by several element instances. The class attribute has several roles in HTML:

  • As a style sheet selector (when an author wishes to assign style information to a set of elements).
  • For general purpose processing by user agents.

There’s a couple of points I’d like to highlight here:

First, notice that classes are multivalued, meaning that elements can have one or more, space-sepearted values.

Next, notice that class values are not just for styling. While this is certainly the most common and well-known use for class values, they are open “for general purpose processing by user agents,” which could easily include non-intrusive scipting and semantics. In fact, classes actually work best when treated as a mechanism for applying semantics, rather than just hooks for styling (see Tantek’s Class for Meaning, not for show).

For a more thorough primer on the use of class values, and how they relate to document structure, see Tantek‘s post, A Touch of Class, which though its 3 years old, is just as relevant today.

Technorati Tags:

Wiki Attack

We had a bit of trouble with our wiki this weekend- on Saturday, we recieved a spam attack from 164 different IP addresses, which deleted pretty much every page on our wiki.

We’ve restored the wiki and locked it down a bit (must be logged in to edit, only admins can create new accounts), but there may still be some inconsistencies or weirdness.

If anyone is working to combat said spammers, email me and I’ll send you the IP list.

Technorati Tags: