views:

54

answers:

2

Hi everybody,

I've got some lists inside lists to make some fancy drop-down menus.

e.g

<ul>
    <li>something
        <ul>
            <li>sub menu</li>
        </ul>
    </li>
</ul>

Problem is, w3c doesn't like it. Is there a way to make this validate or this just one of these hacks that browsers can render, but w3c dislikes?

+1  A: 

this is valid using doctype xhtml 1 transitional

matpol
+1  A: 

The code you posted is correct and valid. According to W3S nesting lists like this:

<ul>
  <li>Coffee</li>
  <li>Tea
    <ul>
      <li>Black tea</li>
      <li>Green tea</li>
    </ul>
  </li>
  <li>Milk</li>
</ul>

is the right way (exactly as you do it). Error is somewhere else. Please provide more code.

Even with DOCTYPE XHTML 1.0 Strict W3C validates this code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Title</title>
</head>

<body>
<ul>
    <li>1</li>
    <li>2</li>
    <li>3
        <ul>
            <li>3.1</li>
            <li>3.2</li>
        </ul>
    </li>
    <li>4</li>
</ul>
</body>
</html>

as correct.

o15a3d4l11s2