Nesting Lists

Sometimes it's very helpful to have nested lists when using both unordered and ordered lists. A nested list is a list within a list. To create a correctly nested list in XHTML, the trick is to be sure the nest is contained completely within an open and closing list item element (see Example 2-6).

Example 2-6. Nesting an Ordered List Within Another Ordered List

<ol><li>Beat eggs, flour, butter and sugar until creamy</li><li>Pour into round baking pan</li><li>Slowly add and swirl the following ingredients in order:     <ol>     <li>Add the chocolate sauce, </li>     <li>Now, add the cinnamon crunchies, </li>     <li>Add 1 tsp nutmeg</li>     </ol></li><li>Place in oven and bake for 40 minutes</li></ol>

Figure 2-6 displays the ...

Get Spring Into HTML and CSS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.