SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Nesting lists

  1. #1
    SitePoint Addict
    Join Date
    May 2007
    Posts
    242
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Nesting lists

    Hello. Is nesting sublists in li elements the right way to create semantically correct Xhtml? Or should I use the code 2 style for that?

    Code 1:
    <ul>
    <li> Some fruit:

    <ul>
    <li> bananas</li>
    </ul>

    </li>
    <li> Some animals:

    <ul>
    <li> lion </li>
    </ul>

    </li>
    </ul>
    Code 2:
    <ul>
    <li> Some fruit: </li>

    <ul>
    <li> bananas</li>
    </ul>

    <li> Some animals: </li>

    <ul>
    <li> lion </li>
    </ul>

    </ul>
    Thanks in advance.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,350
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    code 2 is invalid

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As Rudy said, your first example is correct, while your second example is not.


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
  •