Custom properties in shorthands can void the whole declaration
Manuel Matuzović has flagged a CSS "gotcha" worth keeping in mind: when a custom property is invalid, the cascade doesn't discard it — it evaluates it, and that invalidates the declaration it appears in. Matuzović says the behavior wasn't a surprise once he saw it, but he hadn't considered it until one of his own declarations broke.
The problem compounds inside shorthand properties. Shorthands like background and animation bundle several constituent properties into one declaration, so an invalid custom property in the shorthand takes down the entire declaration — implied constituents included.
His recommendation is blunt:
So, maybe don’t use custom properties in shorthand properties or use custom properties but don’t use shorthand properties.
The takeaway for anyone leaning heavily on custom properties is that the cascade doesn't know everything all at once — and an invalid value can cost more than the single property you meant to set.



