Style backgroundSize Property
Style backgroundSize Property
The backgroundSize property is used to either set or return the size of the background images.
Syntax:-
Its syntax is:- object.style.backgroundSize OR object.style.backgroundSize = auto|length|cover|contain|intial|inherit
Return:-
Its return is:- string having background-size property of an element
Further Explanation:-
Value | Description |
---|---|
auto | The background-image contains its width and height |
length | Sets width and height of the background image i.e, first value set width and the second value set height. |
percentage | Sets width and height of the background image in percent of the parent element i.e, first value set width and the second value set height. |
cover | Scale background image such that the background area is completely covered by the background image. |
contain | Scale image to largest size such that both its width and its height can fit inside content area. |
initial | Sets property to its default value. |
inherit | Inherits property from its parent element. |