In the world of religious loonies, there are two main kinds of nutter. One is the fundamentalist – someone with the attitude that a tract is the work of God, perfect and unquestionable; if it’s mentioned in the Book, it’s beyond doubt no matter how daft. The second sub-genre of nutter is the exegesist: someone who believes that extra, unwritten information may be teased out of the text with enough insight and critical reading.
Web Standards evangelist types will all recognise both type of adherent to that Holy of Holies: the w3c specs.
Fundamentalism and the definition list
Recently, I had my first ever occasion to use a definition list and, being visually unimaginative, I Googled around to get some ideas on how such a beast might be styled. I was staggered at what I found: people were using the humble
<dl> for purposes that seem to me to be miles away semantically from the idea of term and associated definition(s). I’m thoroughly with Andy Budd who writes in his book CSS Mastery:
Many web standards pioneers seized on the fact that definition lists could be used to structurally group a series of related elements and started to use them to create everything from product listing and image galleries, to form and even page layouts. I personally believe that they stretch the implied meaning of definition lists beyond their natural breaking point.
Hear hear. The problem, however, goes back to the html specification of Definition lists which begins entirely sensibly:
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.
So far, so intelligible and semantic. Then, however, author Dave Raggett goes a bit mental and writes,
Another application of DL, for example, is for marking up dialogues, with each DT naming a speaker, and each DD containing his or her words.
Stealing from Tantek, it’s much better semantically to mark up a completely fictional dialogue thus:
<blockquote>Hey, I've just found this crazy-looking mushroom in a field! I think I'll eat it before completing the spec for definition lists!</blockquote>
<blockquote>Great plan! Would you also like this lumpy roll-up I found under a chair in the CERN student common room?</blockquote>
Tantak’s markup is semantic (although I think he then goes a step too far and uses an ordered list to contain each citation and blockquote), but he convincingly shows that a dialogue should not be marked up as a definition list, whatever the damn spec says.
Floats: I know they say that, but they really mean this.
Almost the opposite from the fundamentalist who says “if it’s in the spec it must be right”, the exegeist declares that the authors meant more than they actually wrote.
Lately, I’ve been hearing people say that floats are not really “meant” for laying out web pages. For example, a commentator on Drew Mclellan’s blog writes,
… The CSS 1.0 spec … talks about text wrapping around elements but nothing of multiple columns. Iâ€™ve never seen floats for layouts explicitly forbidden, but itâ€™s pretty obvious that those above were the use cases in mind, and itâ€™s hardly straightforward to use it for layout. (Source)
Now, I was never party to Messrs Lie and Boss’ discussions and decisions when they wrote the spec, and there may be other documents that I don’t know about, detailing what they really really meant, but the CSS1 float spec talks only of floating elements (and a div full of navigation etc is still an element). Admittedly, it also says
“this property is most often used with inline images, but also applies to text elementsâ€ť – but that isnâ€™t normative, and even though it was almost certainly true of most pages when the spec was written, it isn’t the case now. I don’t think any exegesis of authorial intention is possible here. And if the authors felt strongly that it was only for simple elements, well, why not say that in the spec?
We could go on about holes in the specs: the lamentable lack of detail about the address element, the lack of a figure element to allow a caption and other data to be explicitly associated with an image, the fact that you can’t have lists in paragraphs or headings in lists, the inability to style poetry correctly and the resurrection of layout tables in css. We could mention the horrors of WCAG 2. But let’s not.
Let’s just acknowledge that the author’s intention, even when it can be reasonably gleaned from the specification, is not a Holy relic. As a community, we’ve built up a corpus of best semantic practice – let’s not throw the baby out with the bathwater by rejecting floats for layout, or abusing the definition list as the table was once sorely abused in the name of the Holy Specifications.