Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Pseudo-elements

The ::marker pseudo-element

Reference for the CSS ::marker pseudo-element: change the color, size and content of list bullets and numbers without extra markup, with supported properties.

The ::marker pseudo-element selects the marker box of a list item: the bullet of a <ul>, the number of an <ol>, or the arrow of a <summary>. It exists on any element whose display is list-item.

Before ::marker, changing only the bullet color meant hiding the native marker and faking one with ::before. Now you can style the real marker, which keeps numbering, accessibility and list-style behavior intact.

CSS
li::marker {
  color: #e8590c;
  font-weight: bold;
}

Try it

Colored bullets and numbers

Syntax

CSS
selector::marker {
  /* a limited set of properties */
}
Property Value
Applies to List items and other display: list-item elements
Inherited Inherits from the list item
Animatable Its properties follow their own animation rules

Values

The pseudo-element takes no arguments. Supported properties:

Property Description
color Color of the bullet or number.
font-* Size, weight, family and variant of the marker text.
content Replaces the marker with your own text or image.
white-space, direction, unicode-bidi, text-combine-upright Text handling.
animation-*, transition-* Animations of allowed properties.

Box properties such as background, padding and margin do not apply. Use list-style-position and the spacing of the <li> itself to move markers.

Usage notes

  • Pair with list-style-type. Use list-style-type to choose the symbol and ::marker to color it.
  • Counters. ::marker can show a counter with content: counter(list-item) ". ".
  • Summary arrow. summary::marker styles the disclosure triangle of <details>; summary { list-style: none; } removes it.
  • Alignment is limited. You cannot offset a marker with margins. If you need full control, use ::before on a list without markers.
  • Not on every element. A <div> has no marker unless you set display: list-item.
  • Accessibility. A marker added via content may be read aloud. Keep it short or use an alternative text form.

Browser support

Supported in all current browsers. Older versions of Safari accepted only color and font-size, so test other properties if you need to support them.