HTML <li> Tag

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The <li> element represents one list item. It must live inside <ul>, <ol>, or <menu>.

In unordered lists and menus, items are usually shown with bullets. In ordered lists, they are usually numbered or lettered. Nest another list inside an <li> when you need sub-items.

Baseline · Widely available.

Not deprecated as an element. Stable across modern browsers since about July 2015.

Deprecated: type on li.

Do not use the old type attribute on <li>. Control markers with CSS list-style-type instead.

HTML Syntax

syntax.html
<ul>  <!-- or ol / menu -->
  <li>Item text</li>
</ul>

Always write both tags for clarity. Put only list items as direct children of ul / ol / menu.

Attributes

The attributes you will meet on <li>:

AttributeDescriptionTry it
(none required)A bare <li> with text is a normal list itemTry it
valueInteger ordinal for this item in an <ol>; following items continue from itTry it
typeDeprecated — once set numbering style; use CSS insteadAvoid
Parent listMust be inside ul, ol, or menuTry it

Global Attributes

The <li> tag also supports the Global Attributes in HTML.

Live Preview

Switch list type to see how the same <li> items look in ul vs ol.

Same three items; only the parent list (and optional value) changes.

List
  • First item
  • Second item
  • Third item

Unordered list — bullet markers.

HTML Examples

Short, copy-ready snippets. Use Try It Yourself for a live editor.

Example 1 — Items in an Unordered List

Use <ul> when order does not matter.

HTML
<ul>
  <li>Neil Armstrong</li>
  <li>Alan Bean</li>
  <li>Peter Conrad</li>
</ul>
Try It Yourself

How It Works

  1. Open a <ul> for a bulleted list.
  2. Add one <li> per item with clear text.
  3. Close each item with </li>.
  4. Do not put bare text or <p> as a direct child of ul.

Example 2 — Items in an Ordered List

Use <ol> when sequence matters (steps, rankings).

HTML
<ol>
  <li>Preheat the oven</li>
  <li>Mix the batter</li>
  <li>Bake for 25 minutes</li>
</ol>
Try It Yourself

How It Works

  1. Wrap steps in <ol> so order is part of the meaning.
  2. Each <li> becomes the next number automatically.
  3. Keep one idea per item so steps stay scannable.
  4. Nest a list inside an li if a step has sub-steps.

Example 3 — Custom Number with value

On an ordered list, set where numbering should start for that item.

HTML
<ol>
  <li value="3">Third item</li>
  <li>Fourth item</li>
  <li>Fifth item</li>
</ol>
Try It Yourself

How It Works

  1. Use value only inside <ol> (ignored in ul / menu).
  2. Pass an integer — even if the list shows letters or Roman numerals.
  3. Following items continue from that number (3, then 4, then 5).
  4. Prefer start on ol when every item should shift together.

Edge Cases & Pitfalls

Most li bugs are wrong parents, deprecated attributes, or broken nesting.

structure

li outside a list

Valid parents are ul, ol, or menu only (not a bare div).

deprecated

Do not use type on li

Marker style belongs in CSS list-style-type, not presentational HTML.

value

value on ul does nothing useful

The attribute is for ordered lists. Bullets ignore it.

nesting

Nested list goes inside the li

Place the child ul/ol inside the parent li, not as a sibling between items.

children

Only li as direct list children

Do not put text nodes or random elements as siblings of li inside the list.

Browser Support

The <li> element is core HTML in every browser. It is not a Node.js, Deno, or Bun API.

✓ Baseline · Widely available

<li>

Widely available since about July 2015. value on ol works everywhere. Prefer CSS over the deprecated type attribute.

98% Global support (approx.)
Google Chrome All
Full support
Mozilla Firefox All
Full support
Apple Safari All
Full support
Microsoft Edge All
Full support
Opera All
Full support
Samsung Internet All
Full support
Internet Explorer All
Supported
<li> Widely supported

Bottom line: Safe for everyday lists. Keep li inside ul/ol/menu; style markers with CSS.

Key Takeaways

  • Role: <li> is one item in a list.
  • Parent: only inside ul, ol, or menu.
  • value: set the ordinal on an ordered-list item when needed.
  • Deprecated: never use type on li — use CSS.

One line: put each idea in <li>…</li> inside the right list parent.

Default CSS Settings

List markers come from the parent list. Approximate UA styling:

default.css
li {
  display: list-item;
  /* marker from the parent list-style */
}

ul {
  list-style-type: disc;
  padding-inline-start: 40px;
}

ol {
  list-style-type: decimal;
  padding-inline-start: 40px;
}

Change markers with CSS list-style-type (not the deprecated HTML type on li).

Frequently Asked Questions

The li element represents one item in a list. It must sit inside ul, ol, or menu.
In ul (and menu), items are usually shown with bullets. In ol, items are usually numbered or lettered in order.
On an ordered list, value sets that item’s ordinal number. Following items continue from there. It has no meaning in ul or menu.
No. type on li is deprecated. Use the CSS list-style-type property instead.
Yes. Put another ul or ol inside an li to create a nested list.
Browsers can omit the end tag in some cases, but always writing </li> is clearer and safer for beginners.

Next: link

Load stylesheets and other resources with the HTML link element.

link tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful