SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    Non-Member
    Join Date
    Jan 2007
    Posts
    148
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    definition lists for site menu?

    Hi I would like to know what is the correct way of building my xhtml+css menu, whether to just use simple a href or to include the definition list tags, I saw this example somewhere but dont understand the extra benefit of using definition tags.

    Code:
    <dl>
    <dt id="Home"><a href="">Home</a></dt>
       <dt id="About Us"><a href="">About Us</a></dt>
       <dt id="Services"><a href="">Services</a></dt>
    </dl>

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,788
    Mentioned
    151 Post(s)
    Tagged
    3 Thread(s)
    useful if you have something like:
    Code:
    Category
        subcat
        subcat
        subcat
    
    Category
        subcat
        subcat
        subcat
    as you can target the dt and dd tags separately. Generally though a ul would do the job fine

    The example you gave is actually missing the <dd></dd> tags!
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's semantically wrong, since you only have terms and no definitions. A definition list should only be used in cases where each 'list item' consists of at least two values.

    A web page menu is semantically a list of links. The order of the links doesn't (usually) affect the meaning of the list as a whole, so it is an unordered list (<ul>).

    If you have submenus, you should use nested unordered lists.

    A definition list for navigation might be appropriate if you need to explain what each menu item means. To me that indicates that you should come up with better link texts, though.
    Birnam wood is come to Dunsinane

  4. #4
    Non-Member
    Join Date
    Jan 2007
    Posts
    148
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i see thanks alot, so what would be a good example where a definition list would be semantically useful?

  5. #5
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The classical example is a glossary, where the DTs represent the terms and the DDs the definitions of those terms.

    But you can extend this to virtually any list that consists of key/value pairs.
    Birnam wood is come to Dunsinane

  6. #6
    Non-Member
    Join Date
    Jan 2007
    Posts
    148
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ah ok i understand the concept now fully, thanks alot guys


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •