CSS 验证未验证
/* ** ** custom select color ** ** */
::selection {
background: #525252; /* Safari */
}
::-moz-selection {
background: #525252; /* Firefox */
color:#fff;
}
上面的代码没有通过W3C验证器,但我无法理解其原因。
返回以下错误:
伪元素::selection不能 出现在上下文 css21 中 [选择]
伪元素 ::-moz-selection 不能出现在此处 上下文 css21 [-moz-selection]
/* ** ** custom select color ** ** */
::selection {
background: #525252; /* Safari */
}
::-moz-selection {
background: #525252; /* Firefox */
color:#fff;
}
The above code is not passing the W3C validator, but I can't understand the reason for it.
The following error is returned:
The pseudo-element ::selection can't
appear here in the context css21
[selection]The pseudo-element
::-moz-selection can't appear here in
the context css21 [-moz-selection]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
没什么好担心的,第一个是抱怨,因为它正在针对 CSS2.1 进行测试,第二个,正如 Kyle 所建议的,是因为 -moz 前缀
要消除第一个“错误”,请执行以下操作:
单击更多选项链接并将配置文件更改为 CSS 3。
这不能消除第二个错误,并且可能应该学会忽略此类错误。我知道这听起来很痛苦,除非有人可以提供替代建议?
That's nothing to worry about, the first one is complaining because it's being tested against CSS2.1, and the second, as Kyle suggested, is because of the -moz prefix
To silence the first "error", do the following:
Click on the more options link and change the profile to CSS 3.
This can not silence the second error, and should probably learn to ignore this kind of errors. I know it sounds a big of a pain, unless anyone can offer an alternative suggestion?
即使在 CSS 级别 3 下,Mozilla/Webkit 特定的 CSS 元素也不会验证。
Mozilla/Webkit specific CSS elements do not validate even under CSS level 3.
今天,即使是 ::selection 也会出现问题,因为它已从 CSS3 中删除。
Today you have a problem even with ::selection because it was dropped from CSS3.