::marker
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
::marker
CSS 伪元素匹配列表的标记框(通常为一个符号或数字)。它作用在任何设置了 display: list-item
的元素或伪元素上,例如 <li>
和 <summary>
元素。
尝试一下
允许的属性值
在将 ::marker
作为选择器的规则中,只能使用某些 CSS 属性:
- 所有的字体属性
white-space
属性color
属性text-combine-upright
、unicode-bidi
和direction
属性content
属性- 所有的 animation 和 transition 属性
备注: 规范指出,将来可能会支持其他 CSS 属性。
语法
css
::marker {
/* ... */
}
示例
HTML
html
<ul>
<li>Peaches</li>
<li>Apples</li>
<li>Plums</li>
</ul>
CSS
css
ul li::marker {
color: red;
font-size: 1.5em;
}
结果
规范
Specification |
---|
CSS Pseudo-Elements Module Level 4 # marker-pseudo |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
::marker | ||||||||||||
Animation and transition support |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Partial support
- Partial support
- No support
- No support
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.