::marker
CSS pseudo-element(CSS伪元素) 选中一个list item的marker box,后者通常含有一个项目符号或者数字。它作用在任何设置了display: list-item
的元素或伪元素上,例如<li>
和<summary>
。
::marker {
color: blue;
font-size: 1.2em;
}
允许的属性值
在将::marker
作为选择器的规则中,只能使用某些CSS属性:
- All font properties(字体属性)
color
text-combine-upright
,unicode-bidi
anddirection
properties- The
content
property
规范指出,将来可能会支持其他CSS属性。
语法
::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. |
浏览器兼容性
BCD tables only load in the browser
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.