English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
HTML <li> tag defines a list item in the <ol>, <ul> or <menu> of the HTML document. This tag is also commonly referred to as the <li> element.
HTML two column examples: one ordered list (<ol>) and one unordered list (<ul>):
!doctype html> <html> <head> <meta charset="UTF-8"> <title>HTML5 li tag usage (Basic Tutorial Website oldtoolbag.com)</title> </head> <body> <ol> <li>First item</li> <li>Second item</li> <li>Third item</li> <li>Fourth item</li> </ol> <ul> <li>First item</li> <li>Second item</li> <li>Third item</li> </ul> <ul> <li>First item <ol> <li>Nested item A</li> <li>Nested item B</li> <li>Nested item C</li> <li>Nested item D</li> </ol> </li> <li>Second item</li> <li>Third item</li> <li>Fourth item</li> </ul> </body> </html>Test and see ‹/›
In this HTML5In the document example, we have an ordered list <ol> with four <li> list items. Then, we have an unordered list <ul> with three <li> list items. Finally, we have nested an ordered list <ol> within the unordered list <ul>.
IEFirefoxOperaChromeSafari
Currently, most mainstream browsers support the <li> tag.
<li> tag defines a list item.
<li> tag can be used in ordered list(<ol>)、unordered list(<ul>)and menu lists (<menu>).
You can nest <ol, <ul>, and <menu> lists.
"type" attribute in HTML 4.01 It has been abandoned. HTML5 This attribute is not supported.
"value" attribute in HTML 4.01 It has been abandoned. HTML5 This attribute is not supported.
Hint: Please use CSS to define the type of list and list item markers.
Attribute | Value | Description |
---|---|---|
type | 1 A a I i disc square circle | HTML5 This attribute is not supported. HTML 4.01 This attribute is deprecated. Not recommended. Please use styles instead. Specifies which type of list item marker to use. Character value indicating the numbering style. It can be any of the following values: |
value | number | Not recommended. Please use styles instead. Specifies the number of the list item. |
The <li> tag supports global attributes, see the complete attribute table HTML Global Attributes.
The <li> tag supports all HTML Event Attributes.
Different Types of Ordered Lists
Different Types of Ordered Lists
Different Types of Unordered Lists
Different Types of Unordered Lists
Nested Lists
This example demonstrates how to nest lists.
Nested Lists 2
This example demonstrates more complex nested lists.
Custom Lists
This example demonstrates a definition list.
HTML Tutorial: HTML Lists