Creating valid xhtml strict nested lists
To create a nested list that is valid according to the xhtml strict specification, such as the one below:
- Main List
- Sub Item
- Sub Item
- Sub Item
- Sub Item
- Sub Item
- Sub Item
- Main List
- Sub Item
- Sub Item
- Sub Item
- Sub Sub Item
- Sub Sub Item
- Sub Item
- Sub Item
- Main List
- Sub Item
- Sub Item
- Sub Item
- Sub Item
- Sub Item
Follow the code that looks like this:
<ul>
<li>Main List
<ul>
<li>Sub Item</li>
<li>Sub Item</li>
<li>Sub Item</li>
<li>Sub Item</li>
<li>Sub Item</li>
<li>Sub Item</li>
</ul>
</li>
<li>Main List
<ul>
<li>Sub Item</li>
<li>Sub Item</li>
<li>Sub Item
<ul>
<li>Sub Sub Item</li>
<li>Sub Sub Item</li>
</ul>
</li>
<li>Sub Item</li>
<li>Sub Item</li>
</ul>
</li>
<li>Main List
<ul>
<li>Sub Item</li>
<li>Sub Item</li>
<li>Sub Item</li>
<li>Sub Item</li>
<li>Sub Item</li>
</ul>
</li>
</ul>
General Guidelines
-sub lists MUST be encapsulated within the li tags of an item on the base list. I have tried to show this in the blockquote above by indenting each sub list.
- include any formatting within li tags
- use <p> tags to create breaks around an image





Bob Says:
February 10th, 2009 at 5:14 pm
Thanks, this helped a lot!
Horusofoz Says:
May 22nd, 2009 at 7:41 pm
A quick thanks for this. I’m just learning (X)HTML from scratch and was having issues getting my nested lists through the W3 XHTML Validator until I came across this and used it a a reference point for creating my lists and after some effort it worked.
So yeah Thanks.
SLA Says:
June 13th, 2009 at 8:33 am
Thank you!
Dylan Nickelson Says:
August 16th, 2009 at 11:23 pm
Awesome work!
This was causing me a huge headache.
Ollie Says:
November 3rd, 2009 at 1:44 pm
Brilliant, couldn’t figure out what I was doing wrong…till now