<li> Tag in HTML

The <li> tag in HTML represents a list item. It is used inside ordered (<ol>) or unordered (<ul>) lists to define individual items in the list. The <li> tag can also be used within menu lists (<menu>) or description lists (<dl>) in HTML.

Key Points on <li> Tag:

Syntax of <li> Tag:

Syntax Example

<ul>
            <li>Item 1</li>
            <li>Item 2</li>
            <li>Item 3</li>
        </ul>

Example of <li> Tag in HTML:

This example demonstrates how to use the <li> tag in both ordered and unordered lists.

Code Example


<ul>
    <li>Apples</li>
    <li>Bananas</li>
    <li>Cherries</li>
</ul>
<ol>
    <li>First Item</li>
    <li>Second Item</li>
    <li>Third Item</li>
</ol>

Output

  • Apples
  • Bananas
  • Cherries
1.First Item 2.Second Item 3.Third Item

Attributes of <li> Tag:

The <li> tag is fundamental for creating lists in HTML, and it should always be used within a <ul>, <ol>, or <menu> tag. The <li> element supports various types of content, such as text, images, or links, making it a versatile tag for organizing information in a list format.