How to set Bullet colors in HTML Lists using only CSS


03 Jun 2021    |    1233 views

Unordered lists (UL) of bullets, we need to change the color of the bullets in the list using CSS.

The Unicode of the bullet that you want to use for your list.
    Square: "\25AA"
    Circle: "\2022"
    Disc: "\2022"

 

ul {
  list-style: none; /* Remove default bullets */
}

ul li::before {
  content: "\2022";  /* Add content: \2022 is the CSS Code/unicode for a bullet */
  color: red; /* Change the color */
  font-weight: bold; /* If you want it to be bold */
  display: inline-block; /* Needed to add space between the bullet and the text */
  width: 1em; /* Also needed for space (tweak if needed) */
  margin-left: -1em; /* Also needed for space (tweak if needed) */
}

 


Post Comments

954937