# @counter-style

> The `@counter-style` CSS directive allows custom counter styles to be defined for use with list markers.

## How do I create a custom list marker style with @counter-style?

The directive that defines custom counter styles, such as the appearance of list item markers. It allows creating unique bullet points, numbers or symbols for ordered and unordered lists, enhancing list presentation.

- Topic: Directives
- Type: directive
- Browser support: Chrome 91+, Chrome Android 91+, Edge 91+, Firefox 33+, Firefox Android 33+, Safari 17+, Safari iOS 17+

## Example

Wrong:

```css
li::before {
  content: "★ ";
}
```

Right:

```css
@counter-style stars {
  system: cyclic;
  symbols: "★";
  suffix: " ";
}
ul {
  list-style: stars;
}
```

A counter style keeps the marker in `::marker`, so it aligns like a real list bullet.

## Common mistakes

- Using a custom style name in `list-style` without defining it, so the default shows.
- Forgetting `suffix`, so markers have no space before the text.

## Key points

- The rule sets `system` and `symbols`, with a `fallback` for unsupported ranges.
- Lists keep real `<ol>` or `<ul>` markup, so the counter is semantic.

## Interview questions

### Can I extend a built-in counter style?

Yes, `system: extends decimal` reuses an existing style and lets you change `prefix` or `suffix`.

### Can I use `@counter-style` with CSS counters?

Yes, pass the name as the second argument: `counter(step, stars)`.

## Related cards

- [list-style-type](https://wonderium.dev/css/list-style-type.md)
- [::marker](https://wonderium.dev/css/marker.md)
- [counter()](https://wonderium.dev/css/counter.md)
- [Counters](https://wonderium.dev/css/counters-concept.md)
- [`<ol>`](https://wonderium.dev/html/ol.md)

---

- Level: [CSS](https://wonderium.dev/css.md)
- HTML version: https://wonderium.dev/css/counter-style
- Last updated: 2026-11-25
