Home HTML Tags <li> HTML <li> Tag Definition
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.
Syntax
HTML Syntax <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.
Reference
Attributes The attributes you will meet on <li>:
Attribute Description Try it (none required) A bare <li> with text is a normal list item Try itvalueInteger ordinal for this item in an <ol>; following items continue from it Try ittypeDeprecated — once set numbering style; use CSS insteadAvoid Parent list Must be inside ul , ol , or menu Try it
Try it
Live Preview Switch list type to see how the same <li> items look in ul vs ol.
Code
HTML Examples Short, copy-ready snippets. Use Try It Yourself for a live editor.
1. In a ul 2. In an ol 3. value on ol Example 1 — Items in an Unordered List Use <ul> when order does not matter.
<ul>
<li>Neil Armstrong</li>
<li>Alan Bean</li>
<li>Peter Conrad</li>
</ul> Neil Armstrong Alan Bean Peter Conrad How It Works Open a <ul> for a bulleted list.Add one <li> per item with clear text.Close each item with </li>.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).
<ol>
<li>Preheat the oven</li>
<li>Mix the batter</li>
<li>Bake for 25 minutes</li>
</ol> Preheat the oven Mix the batter Bake for 25 minutes How It Works Wrap steps in <ol> so order is part of the meaning.Each <li> becomes the next number automatically.Keep one idea per item so steps stay scannable.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.
<ol>
<li value="3">Third item</li>
<li>Fourth item</li>
<li>Fifth item</li>
</ol> Third item Fourth item Fifth item How It Works Use value only inside <ol> (ignored in ul / menu).Pass an integer — even if the list shows letters or Roman numerals.Following items continue from that number (3, then 4, then 5).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 usefulThe 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.
Compatibility
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.
Remember
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.
UA style
Default CSS Settings List markers come from the parent list. Approximate UA styling:
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 What is the HTML li tag used for? The li element represents one item in a list. It must sit inside ul, ol, or menu.
What is the difference between ul and ol for li? In ul (and menu), items are usually shown with bullets. In ol, items are usually numbered or lettered in order.
What does the value attribute do on li? On an ordered list, value sets that item’s ordinal number. Following items continue from there. It has no meaning in ul or menu.
Is the type attribute on li still OK? No. type on li is deprecated. Use the CSS list-style-type property instead.
Can I nest lists inside li? Yes. Put another ul or ol inside an li to create a nested list.
Must I write the closing </li> tag? 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 Developer, cloud engineer, and technical writer
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
Helpful Share Copy link Suggestion