英文:
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
> 注意:预计未来的规范将扩展此属性列表并放宽哪些属性可以生效的限制。但是目前外部标记框布局尚未完全定义,为了避免未来的兼容性问题,只允许使用这些属性。
英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论