<li>

The HTML <li> element marks an entry in a list, utilized within <ul> (unordered lists) or <ol> (ordered lists) to denote individual items.

<li> Tag

The <li> element is used to represent an item within a list. It must be enclosed within an ordered list <ol>, an unordered list <ul>, or a menu <menu>. In unordered lists and menus, items are displayed with bullet points, whereas ordered lists use numbers or letters for enumeration.

Syntax

index.html
<!-- Unordered list -->
<ul>
  <li>List item 1</li>
  <li>List item 2</li>
  <li>List item 3</li>
</ul>
<!-- Ordered list -->
<ol>
  <li>List item 1</li>
  <li>List item 2</li>
  <li>List item 3</li>
</ol>

Attributes

value

The value attribute in <li> specifies the starting point for an item in an ordered list <ol>. Subsequent items in the list will increment from this number. This attribute is not applicable to unordered lists <ul> or menus <menu>.

type

The type attribute determines the numbering format for an ordered list:

  • a: lowercase letters
  • A: uppercase letters
  • i: lowercase Roman numerals
  • I: uppercase Roman numerals
  • 1: standard numerical order

Examples

For additional examples, refer to the <ol> and <ul> documentation.

Ordered List

  1. First item
  2. Second item
  3. Third item
index.html
<ol>
  <li>First item</li>
  <li>Second item</li>
  <li>Third item</li>
</ol>

Unordered List

  • First item
  • Second item
  • Third item
index.html
<ul>
  <li>First item</li>
  <li>Second item</li>
  <li>Third item</li>
</ul>

Conclusion

The <li> tag is fundamental for creating list items within ordered lists <ol>, unordered lists <ul>, or menus <menu>. It allows for easy organization of content, with customization options like the value and type attributes for ordered lists.