TUTORIALS » HTML / JavaScript » HTML essentials (guided tutorials)Lists in HTML
Another very useful feature of HTML is its capacity to render lists. There are two types of lists:
• Ordered lists (numbered) • Unordered lists (non-numbered) Ordered lists – The <ol> tagTo display an ordered list, all the list items must be enclosed within the<ol>tag. Each list item must be placed within <il>tags. Example code: My favorite fruits are: <ol> <li>Apples</li> <li>Oranges</li> <li>Kiwis</li> </ol>
My favorite fruits are:
Unordered lists – The <ul> tagTo display an unordered list, all the list items must be enclosed within the<ul>tag. Each list item must also be placed within <il>tags. Example code: My favorite fruits are: <ul> <li>Apples</li> <li>Oranges</li> <li>Kiwis</li> </ul>
My favorite fruits are:
Multi level listsYou can also create multi-level lists by nesting<ol>'s and <ul>'s. Just remember to keep a clean nesting of tags and to open-close them in the proper order. Example: My favorite fruits are:
<ol>
<li>Apples
<ul>
<li>Golden Delicious</li>
<li>Red Astrachan</li>
<li>Red Astrachan</li>
</ul>
</li>
<li>Oranges</li>
<li>Kiwis<
<ul>
<li>Hayward</li>
<li>Hinabelle</li>
</ul>
</li>
</ol>
My favorite fruits are:
|
|