Kim Andersen Kim Andersen - 5 months ago 9
CSS Question

Change bullets color of an HTML list without using span

I was wondering if there is a way to change the color on the bullets in a list.

I have a list like this:

<ul>
<li>House</li>
<li>Car</li>
<li>Garden</li>
</ul>


It is not possible for me to insert anything in the li's such as a 'span' og a 'p'. So can I change the color of the bullets but not the text in some smart way?

Answer

If you can use an image then you can do this. And without an image you won't be able to change the color of the bullets only and not the text.

Using an image

li { list-style-image: url(images/yourimage.jpg); }

See

list-style-image

Without using an image

Then you have to edit the HTML markup and include a span inside the list and color the li and span with different colors.