这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。

 ::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.

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic support
Experimental
Chrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile No support NoFirefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android No support No

Legend

No support  
No support
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.

参见

文档标签和贡献者

此页面的贡献者: nDos
最后编辑者: nDos,