I'm having trouble getting my list validate.

liunx

Guest
I've been working on a new update to my site. On my services page I added an orderly list. The list displays exactly the way I want it to but it will not validate as 4.01 Transitional. Here are the errors with the code to follow. <br />
<br />
This page is not Valid HTML 4.01 Transitional!<br />
Below are the results of attempting to parse this document with an SGML parser. <br />
<br />
Line 59, column 7: document type does not allow element "UL" here; assuming missing "LI" start-tag <br />
<ul><br />
^<br />
Line 66, column 7: document type does not allow element "UL" here; assuming missing "LI" start-tag <br />
<ul><br />
^<br />
Here is my code...<br />
<br />
<h5>Services</h5><br />
<ol class="smal"><br />
<li>Web Design</li><br />
<ul><br />
<li>Flat rate web design.</li><br />
<li>Price is very competetive with other design firms.</li> <br />
<li>Site is designed to the clients specifications.</li><br />
<li>Graphics design is included in the quoted price.</li> <br />
</ul><br />
<li>Hosting</li><br />
<ul><br />
<li>Hosting services are available with or without site design.</li><br />
<li>All content management packages include hosting.</li><br />
</ul> <br />
<li>Domain Name is included with the hosting price.</li> <br />
</ol><br />
<br />
Please help before I pull my hair out. Thanks.<br />
:D<!--content-->Taking just an extract:<br />
<br />
<li>Hosting</li><br />
<ul><br />
<li>Hosting services are available with or without site design.</li><br />
<li>All content management packages include hosting.</li><br />
</ul> <br />
<br />
It is wrongly nested. The lower order list should be a list item of the higher order list.<br />
<br />
<br />
<br />
Comparing to tables, you have done this:<br />
<br />
<td> blah </td><br />
<table><tr><td> blah </td></tr></table><br />
</tr></table><br />
<br />
<br />
For tables the correct way is:<br />
<br />
<td> blah <br />
<table><tr><td> blah </td></tr></table> </td><br />
</tr></table><br />
<br />
<br />
so for your nested list, the correct way is also:<br />
<br />
<br />
<li>Hosting<br />
<ul><br />
<li>Hosting services are available with or without site design.</li><br />
<li>All content management packages include hosting.</li><br />
</ul> </li><br />
<br />
<br />
See also, this other [link (<!-- m --><a class="postlink" href="http://www.htmlforums.com/showthread.php?s=&threadid=21890">http://www.htmlforums.com/showthread.ph ... adid=21890</a><!-- m -->)] where this same question was answered just last week. Doing it your way, you would have found that the code works in some browsers, but fails in others, just like Transmothra found.<br />
<br />
This is one of the main reasons for validating your code. It catches silly errors like this, errors that you could stare at for hours and not see what the problem really is.<!--content-->Thanks Giz. I actually managed to get it to validate by using style. I just set a different list style type and indented the lower order in the list. Tonight when I have time I'm going to see if I can get it to validate using your method. :D<!--content-->I just changed my list to the way you described Giz. Very confusing stuff. It validates. I tried adding closing tags to the <li> but it wouldn't validate with them. Why has the W3C decided to make lists so confusing? I thought the purpose was to make life easier. :rolleyes:<!--content-->You must have either put the </li> tags in the wrong place, or you have too many </ul> tags in there still. It validates for me.<br />
<br />
Check my example again, and compare very carefully. See also the longer explanation in the other [thread (<!-- m --><a class="postlink" href="http://www.htmlforums.com/showthread.php?s=&threadid=21890">http://www.htmlforums.com/showthread.ph ... adid=21890</a><!-- m -->)].<!--content-->
 
Back
Top