CSS background properties are used to define the background effects of an html element.
Syntax:
background-propertyName:value;
The CSS background properties used to define the background effects are as follows:
Example:
background-color:#ddd;
background-color:rgb(123,145,224);
background-color:green;
Example:
background-image:url(" url of image");
Syntax:
background-repeat:value;
Value:
When we set the background image of an element using background-image property,we can specify whether the background scrolls with the page or remains fixed when page is scrolled.
Syntax:
background-attachment:value;
Value:
To set the position of an element ,we can position the image used as background of that element using this property.
Syntax:
background-position:value;
Value:
Syntax:
background-propertyName:value;
The CSS background properties used to define the background effects are as follows:
- background-color
- background-image
- background-repeat
- background-attachment
- background-position
1. background-color:value
To specify the background color of an html element .The value can be a hex value, RGB value or color name.Example:
background-color:#ddd;
background-color:rgb(123,145,224);
background-color:green;
2.background-image:value
This property is used to specify the background image of an html element.Example:
background-image:url(" url of image");
3.background-repeat:value
When we set the background image of an element using background-image property, by default, image is repeated both vertically and horizontally and it covers the entire element.To overcome this problem we use background-repeat property.Syntax:
background-repeat:value;
Value:
- no-repeat
- repeat
- repeat-x
- repeat-y
When we set the background image of an element using background-image property,we can specify whether the background scrolls with the page or remains fixed when page is scrolled.
Syntax:
background-attachment:value;
Value:
- fixed
- scroll
To set the position of an element ,we can position the image used as background of that element using this property.
Syntax:
background-position:value;
Value:
- top left
- top center
- top right
- center left
- center center
- center right
- bottom left
- bottom center
- bottom right
- x-% y-%
- x-pos y-pos
0 comments:
Post a Comment
Hey this is a test comment