Anne van Kesteren

Comment markup

Henrik Lied has posted some thoughts on marking up comments. The first example he gives (taken from some weblog) is a pretty interesting thought, though not really correct. Using the BLOCKQUOTE element for marking up comments could probably be seen as the correct thing to do as it is some external input to your site, but it isn’t: The blockquote element represents a section that is quoted from another source.

I like the idea of Web Applications 1.0 — soon to become HTML5 — to nest the ARTICLE element to imply that the things are added there are in relation to their ancestor ARTICLE element. One of the examples in the description of the element mentions weblog comments.

Until that is standardized we probably end up using some of the current semantics solutions of which Henrik mentioned two in his post. One is using the DIV element to group the markup of the commenter in a single box and add an ID attribute for permalinks. The second one he mentions is using an ordered list. If you don't like the idea of chronologically ordering comments or you think comments can be in reply to multiple other comments you can use the unordered list element. Or even the definition list element which is more of a structured grouper nowadays than a really semantic element as it once was. It has also been redefined to that effect.

Comments

  1. Hmm, this get's me thinking. I have always used the div element for my comments but I think it will be better to use an ordered list for the comments. I'm going to do that when I get my site updated.

    Posted by Bjørn Olav at

  2. I think an ordered list works best with the elements that are currently available. But as you said, the ARTICLE element is the perfect element to use in this situation.

    Posted by Jero at

  3. Важното в случая е, че W3C признаха Web Forms 2.0 за “добро” (с малко мъмрене). А също забелязвам, че напоследък се отваря и дума за HTML 5 :-)

    Posted by Огнян Кулев » HTML 5 at

  4. Using BLOCKQUOTE for ordinary comments (like this one) wouldn't be correct, but for trackbacks and pingbacks, it's very suitable, and you will even have a URL to squeeze into the CITE attribute.

    Posted by Asbjørn Ulsberg at