SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
-
Oct 15, 2009, 15:52 #1
- Join Date
- Nov 2008
- Location
- Italy
- Posts
- 154
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Pass markup validation with nested ul unsorted lists
Hi,
I have this code with nested unsorted lists
Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title></title> </head> <body> <ul> <li>List 1</li> <ul> <li>Nested list #1</li> <li>Nested list #2</li> </ul> <li>List 2</li> </ul> </body> </html>
many thanks.
-
Oct 15, 2009, 21:08 #2
- Join Date
- Jul 2005
- Location
- West Springfield, Massachusetts
- Posts
- 17,290
- Mentioned
- 198 Post(s)
- Tagged
- 3 Thread(s)
The validator error message:
Line 10, Column 13: document type does not allow element "UL" here; assuming missing "LI" start-tagBig Change Coming Soon - if you want your PMs save them now!
What you need to do to prepare for our migration to Discourse
A New SitePoint Forum Experience: Our Move to Discourse
-
Oct 15, 2009, 22:32 #3
- Join Date
- Nov 2004
- Location
- Ankh-Morpork
- Posts
- 12,158
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
A ul element can only contain li elements; nothing else. Thus the nested list must reside inside a list item of the outer list.
Code HTML4Strict:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title></title> </head> <body> <ul> <li>List 1 <ul> <li>Nested list #1</li> <li>Nested list #2</li> </ul> </li> <li>List 2</li> </ul> </body> </html>
Birnam wood is come to Dunsinane
Bookmarks