Languages
[Edit]
EN

CSS - how to change bullet color of unordered list?

5 points
Created by:
Root-ssh
178170

In this article, we would like to show you how to change bullet color of unordered list using CSS.

By default, it is not possible to change the bullet color of an unordered list item.

However, you can achieve this effect in the following way:

  1. Remove the existing bullet
  2.  Add new bullet using content: "\2022"; ( \2022 is bullet character unicode),
  3. Change the content (new bullet) color,
  4. Specify the space between the new bullet and list item text,
  5. Move list item with a new bullet to the left (margin-left: -1em;) to the old bullet place.

Note:

You can also customize the bullet with various CSS styles such as font-weight: bold; and so on.

 

Practical example

Edit

In this example, we use the five steps mentioned above to create an unordered list with red bullets.

Alternative solution

Edit

In this example, we remove the existing bullet, create a new one from SVG and set its color using SVG element atribute - fill='silver' (you can use color names and hex colors).

Note:

 Change fill='silver' in the code above to set your own bullet color.

You can use both color names and hex codes.

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join