Avatar byandrev

byandrev

Changing the Bullet Color of a List in CSS

2 min read

When trying to style list bullets (•) or numbers (1.) with a different color than the text, it's common to find that the style applied to the text does not affect the markers. This happens when using <ul> or <ol> tags in HTML, where applying a color directly only changes the text, but not the list markers.

The ::marker Pseudo-Element

CSS provides a pseudo-element called ::marker, which allows direct access to the list markers, bullets in <ul> or numbers in <ol>.

Code Example

ul li::marker,
ol li::marker {
  color: #aaa;
}

This CSS block applies a new color to the list markers.

Browser Support

::marker is well supported in modern browsers: Chrome, Edge, Firefox, Safari, and Opera. It won't work in older browsers like Internet Explorer. But if you're building something modern, that shouldn't be an issue. You can check the detailed support on Can I use.

Small details like this can make a big difference in the aesthetics and consistency of your UI. With ::marker, you now have full control over how your lists look.

Share this article on