A Question Of HTML Part 3 - Definitions

How to use definition tags in the correct way?

22 July 2004 · Last updated: 11 December 2006

Comments


There's a lot of interesting discussion online today regarding the correct use of header tags. (Example posts - Meyer's Pick A Heading and van Kesteren's About The Hierarchy Thing.) One problem with headers is that they are often used in side menus as well as the main column on a page. This got me thinking about replacing the side menu headers with definition tags - <dl>, <dt> and <dd>. I have also been working on the new categories pages for this site. Each uses definitions to display the title of the post and a relevant description underneath, where included. But I want to clarify the exact usage of the markup. Firstly, let's define definition tags:

<dl>
Defines the start of a definition list.
<dt>
Used for the term you wish to define.
<dd>
The description of the term.

Definition tags are useful for a wide range of situations, such as question and answer sessions, photographs and captions, etc. Note how you can use one term and list several definitions for it. Here's a real-world example:

Great Prince Songs
Peach
Purple Rain
Pink Cashmere

Now when it comes to my use of the tags on the category pages, I've put them inside existing list tags. Don't ask me why. Now I'm not sure exactly how the pages should be marked up. Below are a set of examples. Can anyone say which is the correct one to use and why?

Example 1:

  1. <ul>
  2. <li>
  3. <dl>
  4. <dt>This is a post title.</dt>
  5. <dd>What the post is about.</dd>
  6. </dl>
  7. </li>
  8. <li>
  9. <dl>
  10. <dt>This is another post title.</dt>
  11. <dd>What the post is about.</dd>
  12. </dl>
  13. </li>
  14. </ul>

Example 2:

  1. <ul>
  2. <li>
  3. <dl>
  4. <dt>This is a post title.</dt>
  5. <dd>What the post is about.</dd>
  6. <dt>This is another post title.</dt>
  7. <dd>What the post is about.</dd>
  8. </dl>
  9. </li>
  10. </ul>

Example 3:

  1. <dl>
  2. <dt>Category: Name Here</dt>
  3. <dd>This is a post title.
  4. <br />What the post is about.</dd>
  5. <dd>This is another post title.
  6. <br />What the post is about.</dd>
  7. </dl>

Comments (1)

Comments are locked on this topic. Thanks to everyone who posted a comment.

  1. Anne:
    Your third example looks different from the first two, which don't include a category description. I would say:

    dt - title of the post
    dd - short description

    You can number those with CSS. I understand it will limit the styling a bit though, but this has always been a tough issue.

    Posted on 23 July 2004 at 3:36 pm

Useful Info

EMAIL: www.designdetector.com (replace the 1st dot with "@")

NEWSFEED: Subscribe to news of fresh posts and site updates. (RSS 2.0 compatible newsreader required.)

Disclaimer

Some links on this website lead to information provided by external services not under my control, therefore I am not responsible for the content or accuracy of the linked information.

All code examples are not guaranteed 100% free from bugs and/or mistakes. Use them at your own risk. I do not take any blame should a problem occur relating to use of code on this site given as an example for your own use. Such code has been tested and found to work for me, but I cannot vouch for other computer systems (existing now, or in the future) which it may be used on, or changes you introduce yourself based on my code.

This website is © 2008 Christopher Hester, except where separate authors are named. No part of this website may be reproduced or re-used in any way without my prior permission, except content added from separate authors (who retain the copyright on their material), examples of code, and any other content I explicity state is free to copy and make use of.

This page was last updated on 11 December 2006.

What's New

Recent Finds


View previous finds


Current Reading

The Suspicions Of Mr Whicher (Or The Murder At Road Hill House) by Kate Summerscale
5%
Genesis: Chapter & Verse by Tony Banks, Phil Collins, Peter Gabriel, Steve Hackett & Mike Rutherford
70%
Digital Photographer's Handbook by Tom Ang
70%