<li>
HTML <li> Tag
Instance
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文网(php.cn)</title> </head> <body> <p>有序列表:</p> <ol> <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ol> <p>无序列表:</p> <ul> <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ul> </body> </html>
Run Example»
Click the "Run Instance" button to view the online instance
Browser support
Currently most mainstream browsers support < li>label.
Tag definition and usage instructions
<li> Tag definition list item.
<li> tags can be used in ordered lists (<ol>), unordered lists (<ul>) and menu lists (<menu>).
Differences between HTML 4.01 and HTML5
The "type" attribute has been deprecated in HTML 4.01. HTML5 does not support this attribute.
The "value" attribute is deprecated in HTML 4.01. HTML5 does not support this attribute.
Tips and Notes
Tips: Please use CSS to define the types of lists and list items.
Properties
Properties | Value | Description |
---|---|---|
type | 1 A a I i disc square circle | HTML5 does not support this attribute. This attribute has been deprecated in HTML 4.01. Deprecated. Please replace it with a style. Specify which bullet points to use. |
value | number | Deprecated. Please replace it with a style. Specifies the number of list items. |
Global attributes
<li> tag supports global attributes, see the complete attribute table HTML global attributes.
Event attributes
<li> tag supports all HTML event attributes.
Online Example
A nested list
A list within a list.
Instance
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文网(php.cn)</title> </head> <body> <h4>嵌套列表:</h4> <ul> <li>Coffee</li> <li>Tea <ul> <li>Black tea</li> <li>Green tea</li> </ul> </li> <li>Milk</li> </ul> </body> </html>
Run instance»
Click the "Run instance" button to view the online instance
Another nested list
A more complex nested list.
Instance
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文网(php.cn)</title> </head> <body> <h4>嵌套列表:</h4> <ul> <li>Coffee</li> <li>Tea <ul> <li>Black tea</li> <li>Green tea <ul> <li>China</li> <li>Africa</li> </ul> </li> </ul> </li> <li>Milk</li> </ul> </body> </html>
Run instance»
Click the "Run instance" button to view the online instance
Related Articles
HTML Tutorial: HTML List