**`<li>`** only makes sense nested directly inside a list container (`<ul>`, `<ol>`, or `<menu>`) — it's not a standalone element. Inside an `<ol>`, an `<li>` can take a **`value`** attribute to explicitly set (or reset) its number, which also shifts the numbering of any following items that don't specify their own value.
1Understanding <li>
`<li>` only makes sense nested directly inside a list container (<ul>, <ol>, or <menu>) — it's not a standalone element. Inside an <ol>, an <li> can take a `value` attribute to explicitly set (or reset) its number, which also shifts the numbering of any following items that don't specify their own value.
An <li> can contain block-level content — paragraphs, nested lists, images — not just plain text; it's a full container, not just an inline label.
<ul>
<li>Fruits
<ul>
<li>Apple</li>
<li>Banana</li>
</ul>
</li>
<li>Vegetables</li>
</ul>2Practical Example
Here is a real-world application of <li> showing how it is used in production HTML.
<!-- Overriding a specific item's number -->
<ol>
<li>First</li>
<li value="10">Jumps to 10</li>
<li>Continues as 11</li>
</ol>3Best Practices
Follow these guidelines when working with <li>:
1. Only use <li> as a direct child of <ul>, <ol>, or <menu>
2. Nest a full <ul>/<ol> inside an <li> to represent sub-items, rather than faking indentation
3. Use the value attribute on an <li> inside an <ol> when you need to jump the numbering
Tip: An <li> can contain block-level content — paragraphs, nested lists, images — not just plain text; it's a full container, not just an inline label.
<ul>
<li>Fruits
<ul>
<li>Apple</li>
<li>Banana</li>
</ul>
</li>
<li>Vegetables</li>
</ul>