CSS ::marker伪元素为什么只有一些CSS属性有效?而不是所有的都有效?

huangapple go评论72阅读模式
英文:

CSS ::marker pseudo-element why only couple of CSS properties work? why not all?

问题

为什么 ::marker 伪元素不像其他伪元素那样支持所有的CSS属性?
有人能简要解释一下吗?
今天发现 ::marker 伪元素不支持像背景、显示等CSS属性,但 "font-size"、"color" 和 "content" 属性却能正常工作。

英文:

why ::marker pseudo-element not support all CSS properties like other pseudo-elements?
can anyone explain me in brief.

Found out today that ::marker pseudo-element not support all CSS properties like background, display, etc but "font-size", "color", and "content" properties are working like charm.

答案1

得分: 3

CSS Lists specification解释道:

> 注意:预计未来的规范将扩展此属性列表并放宽哪些属性可以生效的限制。但是目前外部标记框布局尚未完全定义,为了避免未来的兼容性问题,只允许使用这些属性

英文:

The CSS Lists specification explains:

> NOTE: It is expected that future specifications will extend this list of properties and relax the restriction on which properties can take effect. However at the moment outside marker box layout is not fully defined, so to avoid future compatibility problems only these properties are allowed.

答案2

得分: 1

因为此选择器选择列表项的标记,例如项目符号。这意味着它只允许您自定义项目符号,而不是列表本身。这就是为什么您不能应用像 display 这样的属性,因为您影响的是标记本身。这可能会有所帮助

英文:

Because this selector selects marker of a list item. Like the buller for example. That means that it allows you only to customize the bullet, not the list itself. Thats why you cant apply properties like display, because you are effecting the marker itself. This can be helpful

huangapple
  • 本文由 发表于 2023年1月6日 15:12:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/75027985.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定