Nested < ul > does not validate.

MikeybobMikeybob Middle o' Farmer Land
edited April 2008 in Internet & Media
Hey again guys.

I have a page with nested uls. When I try and validate it I get this message: "start tag for "LI" omitted, but its declaration does not permit this."

The structure is something like this:

[HTML]
<ul>
<ul>
<li>
<li>
</ul>
<li>
</ul>
[/HTML]

W3 gives you a "depricated" example of nested uls, which sticks an li before the actual nested ul. However, I would have that enforcing an list item before a nested list would be a bit too strict.

Any ideas anyone? Thanks.

Comments

  • KwitkoKwitko Sheriff of Banning (Retired) By the thing near the stuff Icrontian
    edited April 2008
    You have no closing LI tags.
  • MikeybobMikeybob Middle o' Farmer Land
    edited April 2008
    Sorry, I forgot to put that in. They are closed in the actual page :p.

    Btw, I thought it wasn't necessary to close li tags anyway. Or maybe that's just for li tags that have following lis.
  • LincLinc Owner Detroit Icrontian
    edited April 2008
    A nested UL must be INSIDE an LI.

    [html]
    <ul>
    <li>Point A</li>
    <li>Point B
    <ul>
    <li>Sub-point for B</li>
    <li>Sub-point for B</li>
    </ul>
    </li>
    <li>Point C</li>
    </ul>

    [/html]
  • LincLinc Owner Detroit Icrontian
    edited April 2008
    Mikeybob wrote:
    Btw, I thought it wasn't necessary to close li tags anyway. Or maybe that's just for li tags that have following lis.
    It is required for XHTML and it's just best practice in general. Not closing tags is sloppy.
  • MikeybobMikeybob Middle o' Farmer Land
    edited April 2008
    Thanks for the help.

    If I nest the ul inside an li, it then places an empty bullet above the nested list because the ul is at the top. This isn't too much a problem because you can hide the bullet with CSS, but will page readers pick up on it?
  • jaredjared College Station, TX Icrontian
    edited April 2008
    Shouldn't be a problem :D
  • LincLinc Owner Detroit Icrontian
    edited April 2008
    Typically you wouldn't have a "blank" space above the nested UL. A nested list implies that they are subpoints of something, as in my example above. If there is no point "B", the there should be no subpoints for B. It doesn't make semantic sense.
Sign In or Register to comment.