问题
/* ** ** 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]
回答1:
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
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?
回答2:
::-moz-selection
Mozilla/Webkit specific CSS elements do not validate even under CSS level 3.
回答3:
Today you have a problem even with ::selection because it was dropped from CSS3.
来源:https://stackoverflow.com/questions/4931040/css-validation-not-validating