Can I use a div inside a list item?

Manish Basdeo picture Manish Basdeo · Jun 23, 2011 · Viewed 66.5k times · Source

Why is the following code valid when I am using a <div> inside a <li>?

<ul>
    <li class="aschild">
        <div class="nav">Test</div>
    </li>
</ul>

Answer

Jawad picture Jawad · Jun 23, 2011

Yes you can use a div inside a li and it will validate.

<!ELEMENT li %Flow;>
<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*">
<!ENTITY % block     "p | %heading; | div | %lists; | %blocktext; | fieldset | table">