Example
One ordered (<ol>) and one unordered (<ul>) HTML list:
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol><ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
More “Try it Yourself” examples below.
Definition and Usage
The <li> tag defines a list item.
The <li> tag is used in ordered lists(<ol>), unordered lists (<ul>), and in menu lists (<menu>).
Browser Support
| Element | |||||
|---|---|---|---|---|---|
| <li> | Yes | Yes | Yes | Yes | Yes |
Differences Between HTML 4.01 and HTML5
The “type” attribute is NOT supported in HTML5.
The “value” attribute was deprecated in HTML 4.01, but IS supported in HTML5.
Tips and Notes
Tip: Use CSS to define the type of list.
Attributes
| Attribute | Value | Description |
|---|---|---|
| type | 1 A a I i disc square circle |
Not supported in HTML5. Specifies which kind of bullet point will be used |
| value | number | Specifies the value of a list item. The following list items will increment from that number (only for <ol> lists) |
Global Attributes
The <li> tag also supports the Global Attributes in HTML.
Event Attributes
The <li> tag also supports the Event Attributes in HTML.
HTML <li> value Attribute
Example
Use of the value attribute in an ordered list:
<ol>
<li value=”100″>Coffee</li>
<li>Tea</li>
<li>Milk</li>
<li>Water</li>
<li>Juice</li>
<li>Beer</li>
</ol>
HTML <li> type Attribute
Example
Use of the type attribute in an ordered and an unordered list:
<ol>
<li>Coffee</li>
<li type=”a”>Tea</li>
<li>Milk</li>
</ol><ul>
<li>Coffee</li>
<li type=”square”>Tea</li>
<li>Milk</li>
</ul>
