XHTML: Why is my nested UL invalid?

The following menu works very well in the browser, but I cannot check it as XHTML. I took this example from my CSS book. It says it’s correct, but it doesn’t seem to be so.

<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's a link to the page: http://www.yiip.de/arbeit/testlayout/standard_template.html I'm talking about the left menu.

+3
source share
1 answer
<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 few problems:

  • Line 3 as a list item does not have a valid closing element <li>; and
  • subnav1 <li>. , HTML.
+13

Source: https://habr.com/ru/post/1710902/


All Articles