CSS Order and Background Property
Do not leave spaces between the property value and the units! "margin-left:20 px" (instead of "margin-left:20px") will work in IE, but not in Firefox or Opera.
All the styles will "cascade" into a new "virtual" style sheet by the following rules, where number four has the highest priority:
If the link to the external style sheet is placed after the internal style sheet in HTML <head>, the external style sheet will override the internal style sheet!
CSS properties used for background effects:
Eg:
h1{background-color:red} will make the background of H1 red.
div
{
background-image:url('j.jpg');
background-repeat:repeat-x; // will repeat only in X direction.
}
background-repeat:no-repeat; // this will allow the image to be repaeated only once.
div
{
background-image:url('me.jpg");
background-repeat:no-repeat;
background-position: right top;
}
Background ShortHand Property
There are lot of properties for background we can write all of them as one provided we follow the order.The order is as above.
div { background: #fffff url('img.jpg") no-repeat right top}
All the styles will "cascade" into a new "virtual" style sheet by the following rules, where number four has the highest priority:
- Browser default
- External style sheet
- Internal style sheet (in the head section)
- Inline style (inside an HTML element)
If the link to the external style sheet is placed after the internal style sheet in HTML <head>, the external style sheet will override the internal style sheet!
CSS BackGround
- background-color-
Eg:
h1{background-color:red} will make the background of H1 red.
- background-image
By default, the image is repeated so it covers the entire element.
- background-repeat
div
{
background-image:url('j.jpg');
background-repeat:repeat-x; // will repeat only in X direction.
}
background-repeat:no-repeat; // this will allow the image to be repaeated only once.
- background-attachment
- background-position
div
{
background-image:url('me.jpg");
background-repeat:no-repeat;
background-position: right top;
}
Background ShortHand Property
There are lot of properties for background we can write all of them as one provided we follow the order.The order is as above.
div { background: #fffff url('img.jpg") no-repeat right top}
Comments
Post a Comment