Can I use div as a direct child of UL?
No. The only element that may be a child of <ul>
is <li>
.
HTML 4:
<!ELEMENT UL - - (LI)+ -- unordered list -->
(See also how to read a content model definition in a DTD)
HTML 5:
Content model: Zero or more li elements.
No the div cannot be nested inside the element, only < li> can be used as child element. instead of wrapping div inside ul element. you can do something like this
<ul class="class1">
<li class="child1">
<ul>
<li>item1</li>
<li>item2</li>
<li>item3</li>
</ul>
</li>
<ul>
For HTML 5 :
http://www.w3.org/TR/html-markup/ul.html
Permitted contents
Zero or more li elements
For HTML 4 :
http://www.w3.org/TR/html401/struct/lists.html#h-10.2
<!ELEMENT UL - - (LI)+
EDIT :
I forget the other HTML5 :D (which have the same specification on this than the W3C's one)
http://www.whatwg.org/specs/web-apps/current-work/multipage/grouping-content.html#the-ul-element