- Description
Sets the size of background images. First value sets the width, second height. Negative values are not allowed.
Value of contain, scales the image preserving the aspect ratio, to the largest size that will fit within both width and height of the box.
Cover scales the image preserving the aspect ratio, to the smallest size that both width and height will cover the background area.- Live Example
- Play with the code in the textarea below.
- Values
- [ <length> | <percentage> | auto ]{1,2} | cover | contain
- Default value
- auto
- Introduced in CSS version
- 3
- Applies to elements
- All
- Inherited
- Yes
- Browser Support
Browsers IE Firefox Safari Opera Chrome Versions 9 -moz- -webkit -o- -webkit-
Belongs to:
See the full list CSS properties and browser support: CSS Properties