Ordered Lists
Ordered lists provide a list of items, each of which are preceded by an incremental number starting from 1.Sample HTML:
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
- First item
- Second item
- Third item
Unordered Lists
Unordered lists display a list of items, each of which is prefixed by a bullet.Sample HTML:
<ul>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ul>
- First item
- Second item
- Third item
Definition Lists
Definition lists display a list of bolded terms, followed by the definition on a new line and prefixed by a tab (by default).Sample HTML:
<dl>
<dt>Term 1</dt>
<dd>Definition of Term 1</dd>
<dt>Term 2</dt>
<dd>Definition of Term 2</dd>
</dl>
- Term 1
- Definition of Term 1
- Term 2
- Definition of Term 2
<dl>
<dt>Cascading Style Sheets</dt>
<dt>CSS</dt>
<dd>Definition of Cascading Style Sheets (aka CSS)</dd>
<dt>Term 2</dt>
<dd>Definition of Term 2</dd>
</dl>
- Cascading Style Sheets
- CSS
- Definition of Cascading Style Sheets (aka CSS)
- Term 2
- Definition of Term 2
dd
element for each definition, e.g. <dl>
<dt>Mouse</dt>
<dd>Small mammal</dd>
<dd>Input device for a computer</dd>
</dl>
- Mouse
- Small mammal
- Input device for a computer
p
elements within the dd
element. <dl>
<dt>Term 2</dt>
<dd>
<p>First paragraph of the definition.</p>
<p>Second paragraph of the definition.</p>
</dd>
</dl>
- Term 2
- First paragraph of the definition.
Second paragraph of the definition.
Nested Lists
Lists can be nested. An example:<ul>
<li>Lists
<ul>
<li>Numbered Lists</li>
<li>Unnumbered Lists</li>
</ul>
</li>
</ul>
- Lists
- Numbered Lists
- Unnumbered Lists
An example of incorrect nesting:
<ul>
<li>Lists</li>
<ul>
<li>Numbered Lists</li>
<li>Unnumbered Lists</li>
</ul>
</ul>
<ul>
<li>
Outer list item
<ul>
<ul>
<li>
Inner list item within two consecutive UL elements
</li>
</ul>
</ul>
</li>
</ul>