::marker
Styles a list item’s marker: the bullet in a ul list or the number in an ol list.
Example
#.steps li::marker {
color: #a78bfa;
font-weight: 700;
}<ol class="steps stage" style="margin: 0; padding: 12px 12px 12px 34px;">
<li>Choose a world</li>
<li>Watch the introductory video</li>
<li>Solve the first task</li>
</ol>Definition and usage
#Every element with display: list-item, which by default means every <li>, has a marker: a dot, circle, square, or number. The ::marker pseudo-element lets you style it separately, without ::before tricks and without turning off bullets. The item’s text stays unchanged.
The set of supported properties is limited: colour, font properties, content, white-space, plus animations and transitions. Background, margins, or border won’t work. The marker’s position (inside or outside the text block) is set with list-style-position on the list item itself.
The symbol itself is easiest to change with the list-style-type property on the list, for example list-style-type: "✓ " or upper-roman. ::marker is then useful for colour and weight, so that numbers are purple and bold while the text stays regular.
Syntax
#selector::marker { property: value; }Common styles
#- Purple numbers next to regular item text.
- Bold, larger numbers. The item text doesn’t change.
- You set the symbol on the list with
list-style-typeand its colour with::marker. - Hover over a list item: only the colour of its number changes.
Common styles in practice
#color
.demo li::marker { color: #a78bfa; }font-weight
.demo li::marker {
color: #fbbf24;
font-weight: 800;
font-size: 1.15em;
}list-style-type + ::marker
list-style-type and its colour with ::marker..demo { list-style-type: "✓ "; }
.demo li::marker { color: #10b981; }li:hover::marker
.demo li:hover::marker { color: #f43f5e; }Browser support
#Widely available
Works in all modern browsers, phones included. You can use it without worry.
- Chrome
- Edge
- Firefox
- Safari
Good practices
#- Use
list-style-typeto change the symbol itself and::markerfor colour and font. This split is the simplest and most predictable. - If you remove bullets with
list-style: none, VoiceOver in Safari may stop announcing the element as a list. Addingrole="list"to the<ul>or<ol>helps.
Related entries
#- list-style-typeSets the type of list item marker: bullets, numbers, letters, or a custom symbol.
- list-style-positionSets whether the list marker sits outside or inside the element’s block.
- ::beforeCreates a virtual element at the start of an element’s content. Used for icons, decorations, and labels without extra HTML.
- colorSets the text colour and the default colour of borders, decorations and SVG icons that use currentcolor.
- contentInserts generated content in the ::before and ::after pseudo-elements.
Spotted a mistake or missing an example? Write to us.