views:

326

answers:

1

The following menu works really fine in the browser, but I cant get it to validate as XHTML. I took this example out of my CSS Book. It says it is right, but seemingly it is not.

<ul id="leftNavi">
  <li>
    <a href="#" class="SCL">left menu1</a>
  </li>
  <li class="SCNL">left menu2</li>
  <ul id="subnavi">
    <li>
      <a href="#" class="inactive">menu2/1</a>
    </li>
    <li>
      <a href="#" class="inactive">menu2/2</a>
    </li>
    <li>
      <a href="#" class="inactive">menu2/3</a>
    <li>
  </ul>
  <li> 
    <a href="#" class="HCL">left menu3</a>
  </li>
</ul>

Here a link to the page: http://www.yiip.de/arbeit/testlayout/standard_template.html I am talking about the left menu.

+10  A: 
<ul id="leftNavi">
  <li ><a href="#" class="SCL">left menu1</a></li>
  <li class="SCNL">left menu2
    <ul id="subnavi">
      <li><a href="#" class="inactive">menu2/1</a></li>
      <li><a href="#" class="inactive">menu2/2</a></li>
      <li><a href="#" class="inactive">menu2/3</a></li>
    </ul>
  </li>
  <li><a href="#" class="HCL">left menu3</a></li>
</ul>

You had a couple of problems:

  1. The line with 3 as the list item didn't have a correct closing <li> element; and
  2. The subnav1 list wasn't contained within a <li> element. It can't be a direct child of another list, which was the main problem with validating your HTML.
cletus
Thanks for this answer.It seems to work now :)I rly love this page, there is nothing better for a newbie when selfhtml cant help :)
Moritz