简体   繁体   English

CSS验证未验证

[英]CSS validation not validating

/* ** ** 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. 上面的代码未通过W3C验证器,但我不明白其原因。

The following error is returned: 返回以下错误:

The pseudo-element ::selection can't appear here in the context css21 [selection] 伪元素:: selection不能在上下文css21中出现在这里[选择]

The pseudo-element ::-moz-selection can't appear here in the context css21 [-moz-selection] 伪元素:::-moz-selection不能在上下文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]

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 没什么好担心的,第一个抱怨是因为它正在针对CSS2.1进行测试,第二个,正如Kyle建议的那样,是因为-moz前缀

To silence the first "error", do the following: 要使第一个“错误”静音,请执行以下操作:

在此处输入图片说明

Click on the more options link and change the profile to CSS 3. 单击更多选项链接,然后将配置文件更改为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? 我知道这听起来很痛苦,除非有人可以提出其他建议?

今天,即使::: selection也有问题,因为它是从CSS3中删除的。

::-moz-selection

Mozilla / Webkit特定的CSS元素即使在CSS级别3下也无法验证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM