Css background-size attribute, cssbackground-size
The background-size attribute specifies the size of the background image.
Syntax
Background-size: length | percentage | cover | contain;
Length specifies the height and width of the background image.
Set the width of the first value and the height of the second value.
If only one value is set, the second value is set to "auto ".
Percentage specifies the width and height of the background image as the percentage of the parent element. Set the width of the first value and the height of the second value. If only one value is set, the second value is set to "auto ".
Cover extends the background image to a large enough size to completely overwrite the background image. Some parts of the background image may not be displayed in the background positioning area.
Contain expands the image size to the maximum size so that its width and height fully adapt to the content area.
Default Value: auto
Inheritance: no
Version: CSS3
JavaScript Syntax: object. style. backgroundSize = "60px 80px"
IE9 +, Firefox 4 +, Opera, Chrome, and Safari 5 + support the background-size attribute.
Example 1:
<! DOCTYPE html>
Example 2:
<! DOCTYPE html>