background-size
Values
<bg-size>
Applicable to...
All elements
Inherited
No
Description
Defines the size of one or more original background images. If two values are defined (for example: 100px 50%) the first one specifies the horizontal dimension and the second one the vertical dimension. The keyword cover
will stretch the background image so that it covers the full background area even if one of the two dimensions is too big and has to be cut. If you use contain
the background image will be stretched so that at least one dimension of the image touches both sides of the background area.
Examples
Compatibility
Chrome | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|
1.0+ | 3.6+ | 9.0+ | 9.5+ | 3.0+ |
Additional support note
The keywords contain
and cover
are only supported by newer browsers.