b++ Definition list for article comments or IM dialogue
HTML5 is the buzzword this season. Leading people in the industry are using appropriate class names for what will hopefully once become fully supported structural elements. Fully supported = fully supported by browsers.
In getting ready for HTML5 instead of element header:
<header>Site Name</header>
you’d write
<div class="header">Site Name</div>
For the inclined readers, here’s the HTML5 working draft. Quick overview of the element list will help you catch the train.
Definition lists, rediscovered
Definition list is a personal favorite HTML pattern for marking-up 2 or more related content elements. I found it especially useful when nested in list-items on search results pages and various tag/category listings. This raised a lots of controversy in the past and is still raising today, but I won’t go down that route now. Here’s just a quick example, just in case you don’t have a clue what I’m talking about:
<ul>
<li><dl>
<dt>Title</dt>
<dd class="thumbnail"><img src="image.jpg" alt="" /></dd>
<dd class="abstract">Lorem ipsum dolor sit amet...</dd>
</dl></li>
</ul>
The all new rediscovered use of definition lists is with comments or dialogs, for instance Twitter conversation. It has always been it’s intended for this, but now with the dawn of HTML5 (or launch-break for many) it regains the popularity.
HTML4 specs say:
Another application of
DL, for example, is for marking up dialogues, with eachDTnaming a speaker, and eachDDcontaining his or her words.
And here it is:
<dl class="dialog">
<dt>
<a href="http://twitter.com/designer">
<img src="designer.jpg" alt="" /> @designer
</a>
</dt>
<dd>Oh, it looks beautiful with shortcuts.</dd>
<dt>
<a href="http://twitter.com/projectmanager">
<img src="projectmanager.jpg" alt="" /> @projectmanager
</a>
</dt>
<dd>What? But we have full sentences over there!</dd>
<dt>
<a href="http://twitter.com/designer">
<img src="designer.jpg" alt="" /> @designer
</a>
</dt>
<dd>Huh?... but it breaks my grid?!
F*ckin user generated content.</dd>
<dt>
<a href="http://twitter.com/projectmanager">
<img src="projectmanager.jpg" alt="" /> @projectmanager
</a>
</dt>
<dd>Another solution is: we don’t let users post anything.</dd>
<dt>
<a href="http://twitter.com/designer">
<img src="designer.jpg" alt="" /> @designer
</a>
</dt>
<dd>No, we can’t do that neither.
How about we ask
<a href="http://twitter.com/programmer">@programmer</a>
to shorten strings?</dd>
<dt>
<a href="http://twitter.com/projectmanager">
<img src="projectmanager.jpg" alt="" /> @projectmanager
</a>
</dt>
<dd>Clever idea! Go ask him!</dd>
<dt>
<a href="http://twitter.com/designer">
<img src="designer.jpg" alt="" /> @designer
</a>
</dt>
<dd>I came with the idea, <em>you</em> ask him!</dd>
<dt>
<a href="http://twitter.com/projectmanager">
<img src="projectmanager.jpg" alt="" /> @projectmanager
</a>
</dt>
<dd>On second thought, I’ll tell
<a href="http://twitter.com/cssdeveloper">@cssdeveloper</a>
to think of something.</dd>
<dt>
<a href="http://twitter.com/designer">
<img src="designer.jpg" alt="" /> @designer
</a>
</dt>
<dd>See? Problem solved!</dd>
</dl>
Is this making any sense? Or should we just stick with ordered/unordered lists and cite + blockquote pairs?
001—2009.06.05.11:28
I can see what you are getting at. I suppose if you’re working on the premise of some form of forwards compatability with HTML 5 then yeah why not? The markup used above and in the specified context is still valid in HTML 4.
On the other hand, and just playing devil’s advocate, could it be argued that representing a dialogue using an ordered list with cite and blockquote elements is still more semantic?
002—2009.06.05.11:58
I always considered time to be crucial when it comes to conversations, therefore I have always found ordered lists to be the element for the job (along with cite/blockquote combo.)
On another note — I love definition lists, but they lack a wrapper element around the dt/dd pairs which is making them some times tricky to work with.
003—2009.06.05.18:41
I’ve recently used definition lists for marking FAQ dialogue between web site visitor and web site owner, and as Medo said, if you’re working on some compatibility with HTML5 ( element) this could be ideal solution.
004—2009.06.06.05:53
@Dragan Babić: How many times did I miss a wrapper for each pair, and most of the time I’d end-up with my first example, wrapping pairs with
DLand placing it inside a list-item.005—2009.06.19.17:15
http://24ways.org/2007/my-other-christmas-present-is-a-definition-list
Interesting article describes why using definition lists for markin’ up conversations is wrong. I am confused a bit.
006—2009.06.19.17:17
@Mario Kostelac: and this is just the start :)