简体   繁体   English

项目符号点背景颜色属性? CSS

[英]Bullet point background color attribute? CSS

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. 更改字体颜色和项目符号点颜色,但是我只想更改项目符号点颜色,而不管字体。

try like this : LINK 尝试这样: LINK

HTML: HTML:

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

CSS: CSS:

ul {
    list-style-type: square;
    list-style-position: outside;
    list-style-image: none;
    color:#f00;
}
li {
    color:#f00;
}
li span {
    color:#999;
}

Demo 演示

If you don't wish to use <span> or <div> 如果您不想使用<span><div>

You can use :before to add custom bullet to your li 您可以使用:before为您的li添加自定义项目符号

li {
    list-style:none;
}

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

    display:inline-block;
    width:5px;
    height:5px;
}

Try This http://jsfiddle.net/8dGBr/ 试试这个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;
}

just write color:blue; 只需输入颜色:蓝色; and add to <p> or <span> to inner text with color:black 并添加到<p> or <span>到内部文本,颜色为:黑色

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM