0

I'm looking to change the background colour of my bullet points,

ul {
 list-style-type: square;
 list-style-position: outside;
 list-style-image: none;
}

Is there a bullet point background colour attribute? Somthing like this?

list-style-background-color: blue;

EDIT

color: blue

Changes the font colour and the bullet point colour, but I would like to just change the bullet point colour and leave the font alone.

Daft
  • 10,277
  • 15
  • 63
  • 105
  • No, because it's not well-defined how exactly the list marker box should be drawn, and therefore there's no way to determine how this background color will appear in your list styles. There may be workarounds but it all depends on your intended result. – BoltClock Jun 26 '14 at 11:19
  • Are you speaking about the color of the bullet or about the color of the background of the bullet? – web-tiki Jun 26 '14 at 11:20
  • The colour of the bullet and the background of the bullet are separate? I didn't know that. I guess I mean the background-color. – Daft Jun 26 '14 at 11:21
  • possible duplicate of [How to set the Color of Bullets in UL/LI Lists via CSS, WITHOUT using images or span tags?](http://stackoverflow.com/questions/5306640/how-to-set-the-color-of-bullets-in-ul-li-lists-via-css-without-using-images-or) – web-tiki Jun 26 '14 at 11:25
  • 1
    Background of bullet is not the same as color of bullet. In this fiddle, background is gold and color is red : http://jsfiddle.net/webtiki/Jv694/ – web-tiki Jun 26 '14 at 11:32
  • +1 for teaching me summit new @web-tiki :) – Daft Jun 26 '14 at 12:16

4 Answers4

2

try like this : LINK

HTML:

<ul>
    <li><span>one</span>
    </li>
    <li><span>one</span>
    </li>
    <li><span>one</span>
    </li>
    <li><span>one</span>
    </li>
</ul>

CSS:

ul {
    list-style-type: square;
    list-style-position: outside;
    list-style-image: none;
    color:#f00;
}
li {
    color:#f00;
}
li span {
    color:#999;
}
G.L.P
  • 7,119
  • 5
  • 25
  • 41
2

Demo

If you don't wish to use <span> or <div>

You can use :before to add custom bullet to your li

li {
    list-style:none;
}

li:before {
    content: "";
    position:relative;
    left: -10px;
    background-color:red;

    display:inline-block;
    width:5px;
    height:5px;
}
4dgaurav
  • 11,360
  • 4
  • 32
  • 59
1

Try This http://jsfiddle.net/8dGBr/

<ul>
    <li><div>Hi</div></li>
    <li><div>Hi</div></li>
    <li><div>Hi</div></li>
</ul>

li{
    color:blue;
}
li div{
    color:black;
}
Amit
  • 1,841
  • 1
  • 19
  • 36
0

just write color:blue; and add to<p> or <span> to inner text with color:black

aashi
  • 492
  • 3
  • 11