HTML li Tag

Last Updated : 11 Jul, 2025

The <li> (list item) tag in HTML is used to define individual items in a list. It can be used within an Ordered List (<ol>) or Unordered List (<ul>) or description lists <dl>. Each <li> represents a single item within these lists, helping to structure content and make it more readable and accessible.

HTML
<!DOCTYPE html>
<html>

<body>
  <h1>Shopping List</h1>
  <ul>
    <li>Apples</li>
    <li>Bananas</li>
    <li>Oranges</li>
  </ul>

  <h1>To-Do List</h1>
  <ol>
    <li>Buy groceries</li>
    <li>Complete homework</li>
    <li>Walk the dog</li>
  </ol>
</body>

</html>


Note: The end tag can be omitted if the list item is immediately followed by another <li> element, or if there is no more content in its parent element.

Syntax

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

<ol>
<li>First Item</li>
<li>Second Item</li>
<li>Third Item</li>
</ol>

Attribute Value

value: The value attribute is used to specify the starting number of the list item. The list item starts from this number and increments its value with every addition of items to it. The value attribute only works for the ordered lists i.e. <ol> tag.

HTML
<!DOCTYPE html>
<html>

<body>
  <h1>Shopping List</h1>
  <ul>
    <li>Apples</li>
    <li>Bananas</li>
    <li>Oranges</li>
  </ul>

  <h1>To-Do List</h1>
  <ol>
    <li value="4">Buy groceries</li>
    <li>Complete homework</li>
    <li>Walk the dog</li>
  </ol>
</body>

</html>
Comment