Home » HTML » HTML Lists
Web developers can use HTML lists to arrange a collection of similar objects into lists.
The <ul> tag is used to create an unordered list. The <li> tag is used to begin each list item.
Bullets (little black circles) will be used to indicate the list elements by default:
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
The <ol> tag is used to start an ordered list. The <li> tag is used to begin each list item.
By default, the items on the list will be numbered:
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
Description lists are also supported by HTML. A description list is a list of terms that each have a description.
The description list is defined by the <dl> tag, the term (name) is defined by the <dt> tag, and each term is described by the <dd> tag:
Example :
<dl>
<dt>Coffee</dt>
<dd>- black hot drink</dd>
<dt>Milk</dt>
<dd>- white cold drink</dd>
</dl>
Tag | Description |
---|---|
<ul> | Defines an unordered list |
<ol> | Defines an ordered list |
<li> | Defines a list item |
<dl> | Defines a description list |
<dt> | Defines a term in a description list |
<dd> | Describes the term in a description list |
The list-style-type property in CSS is used to determine the list item marker's style. One of the following values can be used:
Value | Description |
disc | Sets the list item marker to a bullet (default) |
circle | Sets the list item marker to a circle |
square | Sets the list item marker to a square |
none | The list items will not be marked |
CSS allows you to customize HTML lists in a variety of ways. To make a navigation menu, one popular method is to design a list laterally.