Web/HTML/Element/li

From Get docs


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.


The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.

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.
Implicit ARIA role listitem when child of an ol, ul or menu
Permitted ARIA roles menuitem, menuitemcheckbox, menuitemradio, option, none, presentation, radio, separator, tab, treeitem
DOM interface HTMLLIElement

Attributes

This element includes the global attributes.

value
This integer attribute indicates the current ordinal value of the list item as defined by the <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: This attribute was deprecated in HTML4, but reintroduced in HTML5.

type '
This character attribute indicates the numbering type:
  • a: lowercase letters
  • A: uppercase letters
  • i: lowercase Roman numerals
  • I: uppercase Roman numerals
  • 1: numbers

This type overrides the one used by its parent <ol> element, if any.

Note: This attribute has been deprecated; use the CSS list-style-type property instead.

Examples

For more detailed examples, see the <ol> and <ul> pages.

Ordered list

<ol>
    <li>first item</li>
    <li>second item</li>
    <li>third item</li>
</ol>

Ordered list with a custom value

<ol type="I">
    <li value="3">third item</li>
    <li>fourth item</li>
    <li>fifth item</li>
</ol>

Unordered list

<ul>
    <li>first item</li>
    <li>second item</li>
    <li>third item</li>
</ul>

Specifications

Specification Status Comment
HTML Living StandardThe definition of '<li>' in that specification. Living Standard
HTML5The definition of '<li>' in that specification. Recommendation
HTML 4.01 SpecificationThe definition of '<li>' in that specification. Recommendation The type attribute has been deprecated.

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
li Chrome

Full support Yes

Edge

Full support 12

Firefox

Full support 1

IE

Full support Yes

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support 4

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

type

Deprecated'Non-standard'

Chrome

Full support Yes

Edge

Full support 12

Firefox

Full support 1

IE

Full support Yes

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support 4

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

value Chrome

Full support Yes

Edge

Full support 12

Firefox

Full support 1

IE

Full support Yes

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support 4

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

Legend

Full support  
Full support
Non-standard. Expect poor cross-browser support.'
Non-standard. Expect poor cross-browser support.
Deprecated. Not for use in new websites.'
Deprecated. Not for use in new websites.


See also

  • Other list-related HTML Elements: <ul>, <ol>, <menu>, and the obsolete <dir>;
  • CSS properties that may be specially useful to style the <li> element:
    • the list-style property, to choose the way the ordinal is displayed,
    • CSS counters, to handle complex nested lists,
    • the margin property, to control the indent of the list item.

<li> by Mozilla Contributors is licensed under CC-BY-SA 2.5.