Css Presentation
Css Presentation
Css Presentation
CSS Syntax
A CSS rule set consists of a selector and a declaration block:
• By default, the background-image property repeats an image both horizontally and vertically.
• Some images should be repeated only horizontally or vertically, or they will look strange, like this:
Example
body
{
background-image:url("gradient2.png");
}
• If the image is repeated only horizontally (repeat-x), the background will look better:
body
{
background-image:url("gradient2.png");
background-repeat:repeat-x;
}
Background Image - Set position and no-repeat
• Note: When using a background image, use an image that does not disturb the text.
• Showing the image only once is specified by the background-repeat property:
Example
body
{
background-image:url("img_tree.png");
background-repeat:no-repeat;
}
In the example above, the background image is shown in the same place as the text. We want to
change the position of the image, so that it does not disturb the text too much.
• The position of the image is specified by the background-position property:
• Example
• body
{
background-image:url("img_tree.png");
background-repeat:no-repeat;
background-position:right top;
}
Cont…
Property Description
Value Description
auto The browser calculates a margin
Value Description
length Defines a fixed padding (in pixels, pt, em, etc.)