CSS backgrounds property is used to control the background effect of the HTML element. These background effects will be:
Followings are the properties of CSS3 backgrounds:
Background Property | Value |
---|---|
background-color: |
It is used to provide background color. |
background-image: |
It is used to provide a background image or gradient around the HTML element. |
background-repeat: |
It has the followings values repeat (default), no-repeat, repeat-x, repeat. |
background-position: |
It is used to set the background-position of the image. |
background-attachment: |
It has followings values: scroll(default), fixed |
background-size: |
It has followings values: auto( default), cover, contains. |
background-origin: |
It has followings predefined values: padding-box(default), content-box and border-box. |
CSS background-color property is used to set the background color of the HTML element. Color can be represented by hexadecimal code, RGBA values, HSL values, and actual color names.
Source Code
body {
background-color: slateblue;
}
h2 {
color: white;
font-size: 2em;
}
The CSS background-image property is used to set the background image at the background of the HTML element.
Source Code
body{
background-image: url('../sliderimages/1.jpg');
}