简体   繁体   中英

Do any browsers support the CSS3 pseudo-element “marker”?

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

  • Firefox since v68.
  • Safari since v11.1 (CSS Module Level 4)
  • Chrome v80 with enabled experimental Web Platform features.

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;
}

Source: https://bugzilla.mozilla.org/show_bug.cgi?id=205202

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.

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