/* ** ** custom select color ** ** */
::selection {
background: #525252; /* Safari */
}
::-moz-selection {
background: #525252; /* Firefox */
color:#fff;
}
上面的代码没有通过 W3C 验证器,但我无法理解其中的原因。
返回以下错误:
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]
最佳答案
1 The pseudo-element ::selection can't appear here in the context css21 [selection]
4 The pseudo-element ::-moz-selection can't appear here in the context css21 [-moz-selection]
这没什么好担心的,第一个是提示,因为它正在针对 CSS2.1 进行测试,第二个,正如 Kyle 所建议的,是因为 -moz 前缀
要消除第一个“错误”,请执行以下操作:
单击更多选项链接并将配置文件更改为 CSS 3。
这不能消除第二个错误,应该学会忽略这种错误。我知道这听起来很痛苦,除非有人可以提供替代建议吗?
关于validation - CSS 验证未验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4931040/