Codectionary / Developer documentation / HTML

<li>

The <li> element represents an individual item within a list — <ul>, <ol>, or <menu>. Its rendering depends on its parent: inside <ol>, browsers add sequential numbering; inside <ul>, they add bullet points. The value attribute lets you override an item's number specifically within an ordered list.

Syntax

<ul>
  <li>List item content</li>
</ul>

Examples

Basic List Items

Simple items within an unordered list.

<ul>
  <li>First item</li>
  <li>Second item</li>
  <li>Third item</li>
</ul>

List Item with Rich Content

A list item can contain more than plain text.

<ul>
  <li>
    <strong>HTML</strong> — the structure of the web
  </li>
  <li>
    <strong>CSS</strong> — the styling of the web
  </li>
</ul>

Overriding a Specific Item Number

Using the value attribute inside an ordered list.

<ol>
  <li>Step one</li>
  <li value="5">Jump to step five</li>
  <li>Step six</li>
</ol>

Attributes

  • value (number): Overrides the item's number when inside an <ol> (has no effect inside <ul>)

Best practices

  • Only use <li> as a direct child of <ul>, <ol>, or <menu>
  • A list item can contain block-level content like paragraphs or nested lists, not just plain text
  • Use the value attribute sparingly, only when you genuinely need to break the natural numbering sequence
  • Avoid using li outside of a list container just to get default spacing or bullet styling

At a glance

Purpose
Structure and meaning for web content
File extension
.html · .htm
Runs in
Web browsers
Usually used with
CSS and JavaScript

Specifications & further reading

Related HTML documentation