views:

67

answers:

3

I am having trouble validating my html, my menus are triggering the following error:

"document type does not allow element "li" here; missing one of "ul", "ol" start-tag"

link to validator

link to site

My code is as follows, the menus are drop-down menus

<ul>
    <li>
        <a href='services' class='inactive'>Services</a>
        <ul>
            <li><a href='services'>Services</a></li>
            <li><a href='brokerage' >Brokerage Group</a></li>
            <li><a href='development-group'>Development Group</a></li>
        </ul>
    </li>
    <li ><a href='contact'>Contact</a></li>
</ul>

Am I missing something? Is the ul after the link tag invalidating my code?

A: 

Your document type is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;

Are you sure you want to use just that. If not try to use below document type:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

Strict document type is checked really strictly; and you should be able to comply with those strict standards.

I am not sure whether this is exactly the cause of issue, but you may want to try it.

Sarfraz
Thank you for the suggestion, I have changed it to transitional without any change in the number of errors.
superUntitled
ok thanks for sharing and letting me know about that. :)
Sarfraz
BS. There's no difference in parsing between Transitional and Strict.
Ms2ger
@ms2ger if that is really so, i probably did not know that. thanks for sharing.
Sarfraz
+3  A: 

The first <li> inside the second <ul> is missing a closing tag ... looks like you've copied and pasted the code, so the error appears a few times.

<ul>
    <li class='headlink'><a href='home' class='inactive'>Home</a></li>
    <li class='headlink'><a href='about' class='inactive'>About</a>
     <ul class='About'>
      <li class='headlink'><a href='about'>About</a> <!-- MISSING TAG HERE -->
      <li><a href='management-team' class='inactive'>Management Team</a></li>
      <li><a href='partners' class='inactive'>Partners</a></li>
      <li><a href='global-one-standard' class='inactive'>Global One Standard</a></li>
      <li><a href='business-investment-opportunities' class='inactive'>Business & Investment Opportunities</a></li>
     </ul>
    </li>
    <li class='headlink'><a href='services' class='active'>Services</a>
     <ul class='Services'>
      <li class='headlink'><a href='services'>Services</a> <!-- MISSING TAG HERE -->
      <li><a href='brokerage' class='inactive'>Brokerage Group</a></li>
      <li><a href='development-group' class='inactive'>Development Group</a></li>
     </ul>
    </li>
    <li class='headlink'><a href='projects' class='inactive'>Projects</a>
     <ul class='Projects'>
      <li class='headlink'><a href='projects'>Projects</a> <!-- MISSING TAG HERE -->
      <li><a href='hilton-garden-inn' class='inactive'>Hilton Garden Inn</a></li>
      <li><a href='federal-plaza' class='inactive'>Federal Plaza</a></li>
     </ul>
    </li>
    <li class='headlink'><a href='contact' class='inactive'>Contact</a></li>
</ul>
Jonny Haynes
Thank you Jonny.
superUntitled
+1  A: 

Check your code very carefully at the locations the validator complains, for example the first error

Line 41, Column 203: document type does not allow element "li" here; missing one of "ul", "ol", "menu", "dir" start-tag

Is because your code looks like this

//...
<ul class='About'>
    <li class='headlink'>
        <a href='about'>About</a>
     //                            <- you have to put </li> here
    <li>
        <a href='management-team' class='inactive'>Management Team</a>
   </li>
Felix Kling