Reputation: 131
I keep getting CSS3 validation errors from W3C for my CSS code and am not sure why. Any ideas would be greatly appreciated. Here is my code.
input:required, input[required] {
border: 2px solid red;
color: #800000;
}
input:valid {
border: 1px solid black;
color: #800000;
}
input:invalid {
box-shadow: none;
border: 2px solid red;
}
Upvotes: 2
Views: 1284
Reputation: 201588
Pseudo-classes such as :required
are not part of CSS, even CSS3, according to definitions applied by the W3C CSS Validator. Generally, what the validator sees as CSS3 is CSS specifications published as W3C Recommendation, Proposed Recommendation, or Candidate Recommendation. Less mature specifications (mostly Working Drafts) are usually not included. There is no official statement on this; it just seems to be the adopted approach.
Thus, for the time being, you need to check manually whether your use of such constructs matches the documents that you wish to adhere to.
Note that Working Draft documents may change at any moment without notice and carry a boilerplate text that they should not be cited except as work in progress. Moreover, implementation status varies a lot.
However, these pseudo-classes are special in the sense that on the CSS track, they are still at a Working Draft level, but they are widely implemented in modern browsers and they have a de facto standard definition in HTML5. (It’s odd that an HTML specification defines CSS constructs, but apparently its authors were frustrated at the slow progress on the CSS track.)
Upvotes: 1
Reputation: 723668
Your CSS is valid. The validator just doesn't recognize the :required
, :valid
and :invalid
pseudo-classes. Don't worry about it.
Upvotes: 3