I need lists inside lists.
What's the most valid way?
<ul>
<li>
<ul>
<li><h2>title</h2></li>
<li>element</li>
<li>element</li>
</ul>
</li>
<li>
<ul>
<li><h2>title</h2></li>
<li>element</li>
<li>element</li>
</ul>
</li>
Would that be valid? And semantic?
A nested list is a list inside another list. You can create a nested unordered list, or a nested ordered list, or even an ordered list nested inside an unordered one. Remember that the only direct child of the ul tag is li .
The only legal element inside ul is li.
Lists may also be nested and different list types may be used together, as in the following example, which is a definition list that contains an unordered list (the ingredients) and an ordered list (the procedure):
To create a nested unordered list, simply add the second unordered list below a list item in the first unordered list. This second list should also contain a parent <ul> element and child <li> elements. You must include the closing </ul> tag or the browser will render all the following list items as nested.
VALID, except your second <h2>
needs to be in a <li>
. You can nest them as much as you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With