Description
The HTML element <li> is used to define a list item of an HTML list, which can be any of the below lists.
The below table summarizes its usage.
| Usage Details | |
| Parent Elements | <ul>, <ol>, <dir>, <menu> |
| Placement | It is displayed as a Block element. |
| Contents | It can contain Block elements, Inline elements, and text. |
| Tags | Both opening and closing tags are required. |
| Versions | HTML 2, 3.2, 4, 4.01, 5 |
Syntax
Here is the basic syntax of the <li> element.
<li>...</li>
Examples
The element <li> is used to define a list item in an unordered list.
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
The element <li> is used to define a list item in an ordered list.
<ol>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ol>
Attributes
The following table shows the list of supported and unsupported attributes for the <li> element.
| Attribute Type | Details |
| Element-Specific Attributes | The tags <li> has some element-specific attributes listed in the below table. |
| Global Attributes | Like all other HTML tags, the tag <li> supports the HTML Global Attributes. |
| Event Attributes | The tags <li> also supports the HTML Event Attributes. |
Here is a list of attributes that are specific to the <li> element.
| Attribute | Value | Description |
type |
circle |
Obsolete Specifies the bullet or numbering type for the list item. |
value |
number | Sets the item number of the current list item in an ordered list. |
Browser Compatibility
The tags <li> is supported in all modern browsers.
- Google Chrome 1+
- Internet Explorer or Edge 2+
- Firefox 1+
- Apple Safari 1+
- Opera 4+