HTML <li> (List Item) Tag
Example
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
</ul>
<ol>
<li>One</li>
<li>Two</li>
<li>Three</li>
</ol>
Meaning
The <li> element is used to specifies a list item as contained in an ordered list <ol>, unordered list <ul>, or older list styles such as <dir> and <menu>.
Notes:
- Under the strict HTML and XHTML definitions, the type and value attributes has been depricated, but you can use CSS properties like list-item-style and CSS counters.
- HTML5 reintroduces the value attribute to list items but CSS should be used.
- Browsers tend to change styles for bullets when <ul> lists are nested.
- Ordered lists generally do not change style automatically, nor do they support outline-style numbering like 1.1, 1.2.
Version: HTML 2, 3.2, 4, 4.01, 5
Standard Syntax
<ol>
<li></li>
</ol>
<ul>
<li></li>
</ul>
Browser Support
Status
Attributes
Attribute | Value | Description |
---|---|---|
value | number | value attribute specifies the current number of items in an ordered list as defined by an ol element. |
type | a A i I 1 |
Deprecated. Specifies the numbering type. |
Global Attributes
<li> element also supports the Global Attributes in HTML.
Event Attributes
<li> element also supports the Event Attributes in HTML.
More Examples
Use of the value attribute in an ordered list.
Example
<ol>
<li value="3">One</li>
<li>Two</li>
<li>Three</li>
</ol>
Nested <ol> element:
Example
<ol>
<li>One</li>
<ol>
<li>One.1</li>
<li>Two.2</li>
</ol>
<li>Two</li>
</ol>
Nested <ul> element:
Example
<ul>
<li>One</li>
<ul>
<li>One.1</li>
<li>Two.2</li>
</ul>
<li>Two</li>
</ul>
By Default CSS Value(s)
Most of the browsers will display the <li> element with the following by default value(s)
li {
display: list-item;
}