About This CSS Issue
The background-size property only accepts auto, cover, contain, or one or two lengths or percentages, so the validator reports any other value, such as default, none or fill.
default is a value of cursor, not of background-size. The default here is auto, which draws the image at its natural size. cover scales the image until it fills the whole element, cropping whatever overflows, and contain scales it until it fits entirely inside. Two values set the width and the height separately, for example 100% auto. The CSS-wide keywords initial, inherit, unset and revert are also accepted.
Browsers ignore the invalid declaration, so the image keeps the size an earlier rule gave it, or auto if no rule did. If you wrote default to undo a cover set elsewhere, the image stays scaled to cover the element until you change the value to auto.
With several background layers, the property takes a comma-separated list such as cover, auto, one size per layer. A bad keyword anywhere in the list, or in either half of a two-value pair, is enough to trigger the error, and the browser then drops the whole declaration. In the background shorthand, where the size goes after the position and a slash, the same mistake produces a different message: “background”: “default” is not a “background” value.
Invalid example
.hero {
background-image: url("hero.jpg");
background-size: cover;
}
.hero.compact {
background-size: default;
}
Valid example
.hero {
background-image: url("hero.jpg");
background-size: cover;
}
.hero.compact {
background-size: auto;
}
Find issues like this automatically
Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.
Help us improve our guides
Was this guide helpful?
Validate at scale.
Ship accessible websites, faster.
Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.
1K Weekly
1,000 monthly checks. Cancel anytime.
Get 1K Weekly →Join teams across 40+ countries