14

I have a list,

    <ul class="listStyle">
        <li>
            <strong>View :</strong> blah blah.
        </li>
        <li>
            <strong>Edit :</strong> blah blah blah.
        </li>
    </ul>

I am using square bullet for list.

    .listStyle{
        list-style-type: square;
    }

Bullets appears in black color. Is it possible change the color of the bullet? If yes, how can i change it?

Please help, Thanks

Erma Isabel
  • 555
  • 2
  • 11
  • 25

3 Answers3

34

Example JS Fiddle

Bullets take the color property of the list:

.listStyle {
    color: red;
}

Note if you want your list text to be a different colour, you have to wrap it in say, a p, for example:

.listStyle p {
    color: black;
}

Example HTML:

<ul class="listStyle">
    <li>
        <p><strong>View :</strong> blah blah.</p>
    </li>
    <li>
        <p><strong>View :</strong> blah blah.</p>
    </li>
</ul>
Michael Robinson
  • 29,278
  • 12
  • 104
  • 130
12

I would recommend you to use background-image instead of default list.

.listStyle {
    list-style: none;
    background: url(image_path.jpg) no-repeat left center;
    padding-left: 30px;
    width: 20px;
    height: 20px;
}

Or, if you don't want to use background-image as bullet, there is an option to do it with pseudo element:

.liststyle{
    list-style: none;
    margin: 0;
    padding: 0;
}
.liststyle:before {
    content: "• ";
    color: red; /* or whatever color you prefer */
    font-size: 20px;/* or whatever the bullet size you prefer */
}
Bhojendra Rauniyar
  • 83,432
  • 35
  • 168
  • 231
  • 1
    pseudo-elements is a poor choice for verbose bullets. Text will wrap under bullet as opposed to be aligned with the text line above with real bullets – vandre May 31 '17 at 14:58
  • 1
    Pseudo-elements are NOT a poor choice: http://jsfiddle.net/leaverou/ytH5P/ – ViliusL Jul 18 '18 at 10:18
0

You have to use image

.listStyle {
    list-style: none;
    background: url(bullet.jpg) no-repeat left center;
    padding-left: 40px;
}
Substantial
  • 6,684
  • 2
  • 31
  • 40
user3074446
  • 124
  • 10
  • 1
    Don't use images for circle, it can be generated using css easily. No requests and zoom support. – ViliusL Jul 18 '18 at 09:58