HTML <li> Tag Tutorial
The HTML <li> tag is used to define a list item within an ordered or unordered list. It stands for "list item".
Here is an example of an unordered list using the <ul> tag and the <li> tag:
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
And here is an example of an ordered list using the <ol> tag and the <li> tag:
<ol>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ol>
The <li> tag can also be used within nested lists to create sub-lists within a main list. Here is an example of a nested list:
<ul>
<li>Item 1</li>
<ul>
<li>Sub-item 1</li>
<li>Sub-item 2</li>
</ul>
<li>Item 2</li>
</ul>
<li> Tag Attributes
Here are the main attributes of the <li> tag and their use:
Attribute | Description |
---|---|
value | Specifies the value of the list item. This attribute is often used with ordered lists to set a specific number for a list item. |
type | Specifies the type of the list item marker. This attribute is used with ordered lists to define the type of numbering or bullet style used. |