CSS Tutorial
You can set backgrounds of various HTML elements
can set the following background properties of an element −
This property is used to set the background color of an element.
The background-color property specifies the background color of an element
When the above code is compiled , it produces the following result.
Code Always.
This is a text inside a div element. So we can set a color for div element.
This property is used to set the background image by calling local stored images.
The background-Image property specifies the background image of an element
By default, the image is repeated so it covers the entire element.
When using a background image, use an image that does not disturb the text.
When the above code is compiled , it produces the following result.
Code Always.
Code Always To Become Best Programmer.
The table shown below describes different type of background properties.
Background Property | Description |
---|---|
background | uses to set all the background properties in one declaration |
background-attachment | uses to set whether a background image is fixed or scrolls with the rest of the page |
background-clip | uses to set the painting area of the background |
background-color | uses to set the background color of an element |
background-image | uses to set the background image for an element |
background-origin | uses to set where the background image(s) is/are positioned |
background-position | uses to set the starting position of a background image |
background-repeat | used to set how a background image will be repeated |
background-size | used to set the size of the background image(s) |