Error Invalid declarations in a rule body
Why a rule block that doesn't parse as property: value pairs gets silently dropped, and common causes.
The validator flags a rule body that contains text but none of it matches the expected property: value; pattern.
Example
/* Wrong: missing colon */
.card {
padding 1rem;
}
/* Right */
.card {
padding: 1rem;
}The most common causes are a missing colon between property and value, a missing semicolon that runs two declarations together, or stray text left over from a paste or edit.
Why it matters
CSS declarations require a strict property: value; shape. When the parser encounters something that doesn't fit — no colon, garbled syntax — it discards just that malformed declaration and, depending on exactly what's broken, sometimes the rest of the block too, then resumes parsing at the next recognizable point. As with most CSS parsing failures, there's no console error or visible warning; the affected styles simply don't apply.
Frequently asked questions
Does one bad declaration break the whole stylesheet?
No — CSS parsing recovers at the rule level. A malformed declaration is dropped (and depending on the exact syntax error, sometimes the surrounding declarations in that block too), but rules elsewhere in the stylesheet keep parsing and applying normally.
How do I find where the invalid text is?
The validator reports a line number alongside this issue — check that line and the declarations immediately around it for a missing colon, semicolon, or unmatched quote/paren.