这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。
::marker
CSS 伪元素 选择列表的前置标记,一般包含着重符号或数字。 任何设置 display: list-item
属性的元素或伪元素都能使用::marker
比如 <li>
和<summary>
元素.
::marker { color: blue; font-size: 1.2em; }
可用的属性
Only certain CSS properties can be used in a rule with ::marker
as a selector:
语法
::marker
示例
HTML
<ul> <li>Peaches</li> <li>Apples</li> <li>Plums</li> </ul>
CSS
ul li::marker { color: red; font-size: 1.5em; }
Result
标准
Specification | Status | Comment |
---|---|---|
CSS Pseudo-Elements Level 4 ::marker |
Working Draft | No significant change. |
CSS Lists Module Level 3 ::marker |
Working Draft | Initial definition. |
浏览器兼容性
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | No | No | No | No | No | No |
Feature | Android webview | Chrome for Android | Edge mobile | Firefox for Android | Opera Android | iOS Safari | Samsung Internet |
---|---|---|---|---|---|---|---|
Basic support | No | No | No | No | No | No | No |