HTML Lists
HTML supports ordered, unordered and definition lists.
HTML Lists
- This is the first
- This is the second
- This is the third
|
|
|
Try-It Examples |
Unordered list
Ordered list
Unordered Lists
An unordered list is a list of items. The list items are marked with bullets (typically
small black circles).
An unordered list starts with the <ul> tag. Each list item starts with the <li> tag.
<ul>
<li>Tea</li>
<li>Milk</li>
</ul> |
Here is how it looks in a browser:
Inside a list item you can put paragraphs, line breaks, images, links, other
lists, etc.
Ordered Lists
An ordered list is also a list of items. The list items are marked with
numbers.
An ordered list starts with the <ol> tag. Each list item starts with the <li> tag.
<ol>
<li>Tea</li>
<li>Milk</li>
</ol> |
Here is how it looks in a browser:
- Tea
- Milk
Inside a list item you can put paragraphs, line breaks,
images, links, other lists, etc.
Definition Lists
A definition list is not a list of single items. It is a list of items
(terms), with a description of each item (term).
A definition list starts with a <dl> tag (definition list).
Each term starts with a <dt> tag (definition term).
Each description starts with a <dd> tag (definition description).
<dl>
<dt>Tea</dt>
<dd>Red hot drink</dd>
<dt>Milk</dt>
<dd>White cold drink</dd>
</dl> |
Here is how it looks in a browser:
- Tea
- Brown hot drink
- Milk
- White cold drink
Inside the <dd> tag you can put paragraphs, line breaks,
images, links, other lists, etc.
|
More Examples |
Different types of ordered
lists
Demonstrates different types of ordered lists.
Different types of
unordered Lists
Demonstrates different types of unordered lists.
Nested list
Demonstrates how you can nest lists.
Nested list
2
Demonstrates a more complicated nested list.
Definition list
Demonstrates a definition list.
List Tags
Tag |
Description |
<ol> |
Defines an ordered list |
<ul> |
Defines an unordered list |
<li> |
Defines a list item |
<dl> |
Defines a definition list |
<dt> |
Defines a term (an item) in a definition list |
<dd> |
Defines a description of a term in a definition list |
<dir> |
Deprecated. Use <ul> instead |
<menu> |
Deprecated. Use <ul> instead |
|