The list tags
HTML caters for three types of list:
- unordered list
- ordered (or numbered) list
- definition list
Unordered list: <ul>
<ul> </ul> the opening and closing tags for the entire list
<li> </li> the opening and closing tags for each list item
Example: <ul>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ul>
This is displayed as:
- First item
- Second item
- Third item
To add space between the items, insert a blank line using <p /> like this:
<ul> <li>First item</li> <p /> <li>Second item</li> <p /> <li>Third item</li> </ul>
The attributes
type specifies the shape of the bullet
circle, disc or square
Ordered (numbered) list: <ol>
<ol> </ol> the opening and closing tags for the entire list
<li> </li> the opening and closing tags for each list item
Example: <ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
This is displayed as:
- First item
- Second item
- Third item
The attributes
type specifies the shape of the bullet
A (capital letters)
a (lowercase letter)
I (capital Roman numerals)
i (lowercase Roman numerals)
start specifies the number to start at
Definition list: <dl>
<dl> </dl> the tags for the entire list
<dt> </dt> the tags for each term to be defined
<dd> </dd> the tags for the definition
Example: <dl>
<dt>Planet
<dd>A body rotating freely around a star</dd>
</dt>
<dt>Moon
<dd>An object rotating around a planet</dd>
</dt>
</dl>
This is displayed as:
- Planet
- A body rotating freely around a star
- Moon
- A smaller object rotating around a planet
