Anne van Kesteren

Semantics versus structure

(Safari should support min-height so I can hack around for business pages. I think I'll drop support for Safari 1.2 for that particular site. Dave Winer notices the Google + Blogger/Atom effect (after Matt, obviously). I have been using IRC for some time now, any Dutch people who are willing to join for no particular reason? Note that the channel might not always be available and that we already have two members, me and Bas.)

To the point. Probably everyone who works or tries web standards has to make the simple choice. Choosing elements for the structural aspects or their semantic ones. Quite a simple example of an element, which is often being abused from a semantic point of view is the definition list and child elements (more precisely: the relationship between DT and DD). While everyone reading the specifications can read what their purpose is:

Definition lists vary only slightly from other types of lists in that list items consist of two parts: a term and a description. The term is given by the DT element and is restricted to inline content. The description is given with a DD element that contains block-level content.

People, including myself, are using the structurally "defined" relation between DT and DD, while ignoring the semantical relationship. You could read SimpleBits: Numbered List Pairs for examples. It might be clear, or not, that we do that on purpose. Abusing the semantic value of some elements for structural benefit. Note that those semantic values are very loosely defined by HTML 4.01 and free for interpretation, which is what I and other people, are doing.

Using a DIV element with an appropriate CLASS attribute value, not 'left', 'blue' or any other presentational hint as you see on a lot of sites, feels a bit like a hack to me. While other people seem to really like that element, I try to avoid them as much as possible, using elements that are structurally "better". So basically I see the web in different layers (like Photoshop I assume): structure, semantics, styling, behavior (yes, that is the order I prefer). It would be nice when the W3C released a CSS-alike language to define semantics. Behavior can be added as XBL though it relies to much on CSS in my humble opinion.


  1. Is it really necessary to seperate structure from semantics? As we all know, the word semantics in the web development context is used as adding meaning to content. This applies to both human and non-human actors. As such, we should use structure for our documents, and if we do it correctly, the structure is also meaningful (or semantic). The use of dl therefore marks up your content in a structured way and thus makes it meaningful for both humans and computers.

    I think what you're trying to say here is that many elements in XHTML have some predefined meaning attached to them. Should we markup content according to that predefined meaning (their semantics or according to the structure of the content and context in which it is placed? If you follow my proceeding argument, I think we should use the markup which best fits the structure of the content in its context, and add the markup which fits closest to this structure.

    The many problems which Dan nicely illustrates in his SimpleQuiz series just shows that HTML has very little expressive semantics.

    Posted by Jeroen Coumans at