小编sno*_*ity的帖子

没有任何选择器的Css伪类,可以吗?

选择器就像

.some-class :first-child
Run Code Online (Sandbox Code Playgroud)

选择内部第一个子节点.some-class在所有浏览器中按预期工作,即使在IE8中也是如此.

但移动Chrome的"Reduce数据选项"会删除之间的空格,.some-class:first-child通过将样式应用于.some-class元素本身来打破CSS .在其他情况下,.class1 .class2Chrome会保持空间不变.也许,它认为之间的空间.some-class,并:first-child成为非语义空间,因为它认为不可能有一个伪类没有某种选择的.

但我检查了标准,并没有说伪类必须有选择器的任何地方.同时,所有带有伪类的例子都包含一个元素选择器

p:first-child
Run Code Online (Sandbox Code Playgroud)

所以我很困惑.这个CSS选择器是不正确的还是Chrome的"减少数据使用"中存在错误?

css google-chrome css-selectors

6
推荐指数
1
解决办法
198
查看次数

标签 统计

css ×1

css-selectors ×1

google-chrome ×1