Welcome to WebmasterWorld Guest from 126.96.36.199 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
How to do nested ul-lists that validate and look ok? the_nerd msg:3179709 8:05 am on Dec 6, 2006 (gmt 0) Hi,
now that I try and please W3's validator all my nested menus are broken. Maybe someone can lend me a hand?
I used to nest my menus like this:
li/ li/ ul li/ li/ /ul /ul
That doesn't validate, although it's easy to format.
so now I did it in a correct (think so) way:
li/ li/ li ul li/ li/ /ul /li /ul
w3 likes it, but the li that's nested around the inner ul always brings in a new line (or spacing or whatever) before the inner list.
How do I get the list to look "right"?
SuzyUK msg:3179738 8:57 am on Dec 6, 2006 (gmt 0)
>> (or spacing or whatever)
shouldn't be, however the <li> that you're nesting the child ul in should have it's usual other content (blue text below), you shouldn't need an extra list element for the sole purpose of nesting a UL in, the sample below has no gaps
<ul> <li>list item one</li> <li> list item two <ul> <li>nested list item one</li> </ul> </li> <li>list item 3</li> </ul>
or alternatively is there any CSS rules applied to the list that could be affecting the new nest?
the_nerd msg:3179765 9:38 am on Dec 6, 2006 (gmt 0)
thanks for your help. I had hoped to be able to post this "uhhhm sorry I figured it out now ...." before you came and nailed me ;-)
While looking for an answer I found this: [
...] (it's linked from w3.net, so I thought it's ok to mention here) css.maxdesign.com.au