Style background Property
Style background Property
The background property is used to either set or returns up to eight separate background properties. It is a shorthand form of these eight properties. These are:-
- background-color
- background-image
- background-repeat
- background-attachment
- background-position
- background-size
- background-origin
- background-clip
We can specify each of these properties separately and this approach is highly recommended.
Syntax:-
Its syntax is:- object.style.background OR object.style.background = color image repeat attachment position size origin clip|initial|inherit
Return:-
Its return is:- string having background of an element
Further Explanation:-
Value | Description |
---|---|
color | Sets background color of an element |
image | Sets background image for an element |
repeat | Sets how a background image will be repeated |
attachment | Sets whether a background image is fixed or scrolls with the page |
position | Sets starting position of a background image |
size | Sets size of a background image |
origin | Sets background positioning area |
clip | Sets painting area of a background image |
initial | Sets property to its default value. |
inherit | Inherits property from its parent element. |