# `<li>`

> The `<li>` HTML element represents an item in an ordered list, an unordered list or a menu.

## What is the li element and where can I use it?

The element that represents an item in a list, whether ordered (`<ol>`) or unordered (`<ul>`). It's used to structure content in a clear, bullet-point or numbered format, making information easy to read and scan.

- Topic: Lists
- Type: tag
- Browser support: Chrome 1+, Chrome Android 18+, Edge 12+, Firefox 1+, Firefox Android 4+, Safari 3+, Safari iOS 1+

## Example

Wrong:

```html
<div class="tags">
  <li>CSS</li>
  <li>HTML</li>
</div>
```

Right:

```html
<ul class="tags">
  <li>CSS</li>
  <li>HTML</li>
</ul>
```

`<li>` must sit inside a list element so browsers and screen readers treat the items as a list.

## Common mistakes

- Using `<li>` without a list parent, which is invalid and loses list semantics.
- Wrapping groups of `<li>` elements in a `<div>` inside the list.

## Key points

- Every `<li>` has a `<ul>`, `<ol>` or `<menu>` as its parent.
- Sub-lists are placed inside an `<li>`, not between items.

## Interview questions

### Can an li contain block elements like div or p?

Yes. An `<li>` accepts flow content, including paragraphs, headings and nested lists.

### How do I change the number of one li?

In an `<ol>`, set the `value` attribute on that `<li>`. Following items continue counting from it.

### How do I style the bullet of an li?

Use the `::marker` pseudo-element for color and size, or `list-style-type` to change the symbol.

## Related cards

- [`<ul>`](https://wonderium.dev/html/ul.md)
- [`<ol>`](https://wonderium.dev/html/ol.md)
- [::marker](https://wonderium.dev/css/marker.md)
- [listitem](https://wonderium.dev/a11y/listitem.md)

---

- Level: [HTML](https://wonderium.dev/html.md)
- HTML version: https://wonderium.dev/html/li
- Last updated: 2026-11-25
