CSS Background Property
Description
The background style is a shorthand so you can set many of the background options in one go. Note if you do not provide a value for all the options the default will automatically be applied.
background:
background-color
background-image
background-repeat
background-attachment
background-position;
Examples for Background
test text test text test text test text
<style>
#test { background:red; }
</style>
<div id="test">test text test text test text test text</div>
Values for <background>
| background-color |
red
#ff0000
rgb(100%,0%,0%)
transparent |
Set the background color of the element. |
| background-image |
url(URL) e.g. url(images/image1.jpg) none |
Specifies an image to display in the background of the element |
| background-repeat |
repeat repeat-x repeat-y no-repeat |
Specifies the repeat style of the background image. repeat-x causes tiling to the left and the right, repeat-y causes tiling up and down |
| background-attachment |
scroll fixed |
Specifies if background image scrolls or is fixed when the page is scrolled |
background-position
(note two values one for x and one for y |
For y %|px|top|center|bottom For x: %|px|left|center|right
e.g. top left e.g. 50% right e.g. 50% 20px |
Specifies the position of the background image. Or if tiling then indicates the origin of the tiling |