Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

obelix

macrumors member
Original poster
Oct 20, 2004
99
0
Having given up on my Mac IE conversion (sigh) I moved onto the next thing... nested lists. I have been doing it like so:

Code:
<ul id="listMain">
    <li>MainMenu1</li>
    <li>MainMenu1</li>
        <ul id="listSub">
            <li>SubMenu</li>
        </ul>
    <li>MainMenu1</li>
    <li>MainMenu1</li>
    <li>MainMenu1</li>
</ul>

But upon trying to validate the html it complains (and rightfully so) that the use of the nested lists is deprecated. Below is the exact result:

Line 135, column 23: document type does not allow element "UL" here; assuming missing "LI" start-tag
<ul id="listSub">


So now here's the question.. how does one make nested lists without using this method? W3C suggests the use of dd and dt tags but this just seems silly. How do you guys do it?
 
Nevermind figured it out. Apparently nesting still works as long as you enclose the nested <ul> inside of its own <li> tag. :D amazing what a bit of research can do... sorry for bothering anyone with this post :D
 
Code:
<ul id="listMain">
    <li>MainMenu1</li>
    <li>MainMenu1</li>
    [color=red]<li>[/color]
        <ul id="listSub">
            <li>SubMenu</li>
        </ul>
    [color=red]</li>[/color]
    <li>MainMenu1</li>
    <li>MainMenu1</li>
    <li>MainMenu1</li>
</ul>
 
Generally for nested lists, you would put the nested list in an element that has a heading
Code:
<ul id="listMain">
    <li>MainMenu1</li>
    [color=red]<li>MainMenu1
        <ul id="listSub">
            <li>SubMenu</li>
        </ul>
    </li>[/color]
    <li>MainMenu1</li>
    <li>MainMenu1</li>
    <li>MainMenu1</li>
</ul>
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.