[thelist] marking up titles for definition lists

Christian Heilmann lists at onlinetools.org
Sun Feb 20 18:28:28 CST 2005


David Siedband wrote:

> What are the best practices for marking up titles of definition 
> lists?  I have a page with several d-lists and I want to associate 
> them with their titles.  Something like the way a <legend> definition 
> wraps the content of the <fieldset> would be excellent.
>
> This is what I'm using at the moment:
>
> <h2>Surfing Terms</h2>
>   <dl>
>     <dt>Dawn Patrol</dt>
>       <dd>An early morning surf session.</dd>
>     <dt>Evening Glass</dt>
>       <dd>A late afternoon surf session.</dd>
>   </dl>
>
> Validation fails if I nest the <h2> inside the <dl>
>
> is there a better way to tag this?


Sadly enough, no. One of the big mistakes of the HTML specs is that the 
headlines don't incorporate their connected elements but preceed them. 
One option would be to nest the lot in one unnumbered list (including 
the headlines and the DLs in an  LI each).

XHTML2 is planned to have a <section> and <h> to work around that.  
We'll be  fine  in  2030  when all browsers support it.
 



More information about the thelist mailing list