The HTML <li>
tag is used for specifying a list item in ordered and unordered lists.
This element can be used in conjunction with the <ol>
and <ul>
elements to provide each individual list item within those elements. It can also be used with the <menu>
element, however, this element is not supported by the W3C HTML5 specification - it is only supported by the WHATWG HTML Living Standard.
The three examples below demonstrate usage of the <li>
element.
<ol>
<li value="5">Cats</li>
<li>Dogs</li>
</ol>
<ol>
<li>Cats</li>
<li>Dogs</li>
</ol>
<ul>
<li>Cats</li>
<li>Dogs</li>
</ul>
The following table shows the attributes that are specific to this tag/element.
Attribute | Description |
---|---|
value | Specifies the value of the list item. The value must be a number. Can only be used if the list is an ordered list (i.e. <ol> ). |