The spec specifies that one can modify list-item ( li
) markers using the pseudo-element "marker" like so:
li::marker { color: blue; }
But I can't seem to get it to work in any of my browsers.
Do any browsers support this? Or am I doing something wrong?
To answer your question: no, no browser supports this as of today.
Update 2020
Could you use :before
instead?
li {
display: block;
list-style-position: inside;
margin: 0;
}
li:before {
content:" • ";
color: green;
}
While no browsers support the spec, Firefox has it's own way of doing things:
li::-moz-list-bullet {
color:blue;
}
You can't change the color of the marker alone , however you can change its image using list-style-image see here . Work-around:
<ul><li style="color:blue;"><span style="color:black">test</span></li></ul>
没有浏览器支持这个,但可以使用 (list-style-type: 和 list-style-image) 属性或伪类之前和之后。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.