HTML <li>
Tag
Topic: HTML5 Tags ReferencePrev|Next
Description
The <li>
(short for list item) defines an individual list item within a list. Each list item usually rendered with a bullet (in unordered lists, defined by the <ul>
tag) or a number or letter (in the case of ordered lists, defined by the <ol>
tag). The appearance of bullet or the number can be controlled with the type
attribute.
The following table summarizes the usages context and the version history of this tag.
Parent: | <ul> , <ol> , <dir> , <menu> |
---|---|
Placement: | Block |
Content: | Block, inline, and text |
Start/End Tag: | Start tag: required, End tag: required |
Version: | HTML 2, 3.2, 4, 4.01, 5 |
Syntax
The basic syntax of the <li>
tag is given with:
The example below shows the <li>
tag in action.
Example
Try this code »<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
Tag-Specific Attributes
The following table shows the attributes that are specific to the <li>
tag.
Attribute | Value | Description |
---|---|---|
type |
circle |
Obsolete Specify the bullet or numbering type for the list item. |
value |
number | Sets the number of the current list item (only for ordered lists). |
Global Attributes
Like all other HTML tags, the <li>
tag supports the global attributes in HTML5.
Event Attributes
The <li>
tag also supports the event attributes in HTML5.
Browser Compatibility
The <li>
tag is supported in all major modern browsers.
Basic Support—
|
Further Reading
See tutorial on: HTML Lists.