Skip to content

24 ways to impress your friends

Vote down?

Sophie Dennis

I am in favour of widening the semantic usage of the definition list as per the HTML 5 spec. Being overly restrictive about the context in which a tag can be used – basically arguing for an extremely literal interpretation of the words “definition”, “term” and “description” – will ultimately make the web less semantic rather than more, as people reach for even clumsier alternatives.

The definition list is the best option HTML offers for marking up name/value pairs, and such use is entirely consistent with both existing and future specifications. Norm’s deconstruction of how it doesn’t actually work for dialogue – as suggested by the example in the HTML4 spec – is excellent, but I agree with other commenters that using it to mark up the cast and crew of a movie (director equals Stanley Kubrick), or for a product specification (resolution equals 1024 × 768) is entirely appropriate and should be encouraged.

Put simply ‘Director’ is a term, and ‘Stanley Kubrick’ describes the Director of the movie 2001: A Space Odessey. Maybe not what your high school English teach was after when she asked for something descriptive (by which she probably meant poetic), but it is a description nonetheless. The dl is also excellent in this context as there can be multiple directors marked up with multiple dds, or one person can fulfil several functions – writer, director, producer – and so be marked up with multiple dts. A dl is therefore a vastly superior choice than alternatives such as heading + paragraph, lists with semi-semantic elements like em or strong, or a table with headings.

One problem with the historic HTML specs is the inbalance in what can be marked up semantically and what can’t. This confuses newer coders, as with the very best of intentions they search for a semantic element which simply doesn’t exist, and fuels HTML’s detractors who can rightly point out it’s limitations as a semantic markup language. An approach which encourages the semantic use of tags which we already have will utlimately be beneficial to the adoption of semantic HTML.