The HTML <li>
element is used to represent an item in a list. It must be contained in a parent element: an ordered list (<ol>
), an unordered list (<ul>
), or a menu (<menu>
). In menus and unordered lists, list items are usually displayed using bullet points. In ordered lists, they are usually displayed with an ascending counter on the left, such as a number or letter.
Content categories | None. |
---|---|
Permitted content | Flow content. |
Tag omission | The end tag can be omitted if the list item is immediately followed by another <li> element, or if there is no more content in its parent element. |
Permitted parents | An <ul> , <ol> , or <menu> element. Though not a conforming usage, the obsolete <dir> can also be a parent. |
Permitted ARIA roles | menuitem, menuitemcheckbox, menuitemradio, option, presentation, radio, separator, tab, treeitem |
DOM interface | HTMLLIElement |
This element includes the global attributes.
value
<ol>
element. The only allowed value for this attribute is a number, even if the list is displayed with Roman numerals or letters. List items that follow this one continue numbering from the value set. The value attribute has no meaning for unordered lists (<ul>
) or for menus (<menu>
). Note: Prior to Gecko 9.0, negative values were incorrectly converted to 0. Starting in Gecko 9.0 all integer values are correctly parsed.
type
deprecateda
: lowercase lettersA
: uppercase lettersi
: lowercase Roman numeralsI
: uppercase Roman numerals1
: numbers<ol>
element, if any. list-style-type
property instead.<ol> <li>first item</li> <li>second item</li> <li>third item</li> </ol>
The above HTML will output:
<ol type="I"> <li value="3">third item</li> <li>fourth item</li> <li>fifth item</li> </ol>
The above HTML will output:
<ul> <li>first item</li> <li>second item</li> <li>third item</li> </ul>
For more detailed examples, see the <ol> and <ul> pages.
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of '<li>' in that specification. | Living Standard | |
HTML5 The definition of '<li>' in that specification. | Recommendation | |
HTML 4.01 Specification The definition of '<li>' in that specification. | Recommendation | The type attribute has been deprecated. |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | 1.0 (1.7 or earlier) | (Yes) | (Yes) | (Yes) |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | 1.0 (1.0) | (Yes) | (Yes) | (Yes) |
<ul>
, <li>
, <menu>
, and the obsolete <dir>
;<li>
element: list-style
property, to choose the way the ordinal is displayed,margin
property, to control the indent of the list item.
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li