HTML and CSS Reference
In-Depth Information
body {background-image: url(backgrounds/watermark.gif);
background-position: center center;
background-repeat: no-repeat
}
A popular trick is to create a vertical ribbon down the righthand side of
the page:
body {background-image: url(backgrounds/ribbon.gif);
background-position: top right;
background-repeat: repeat-y
}
8.4.5.6. The background property
Like the various font properties, the many background CSS2 properties
can get cumbersome to write and hard to read later. So, like the
font
property, there is also a general
background
property.
The
background
property accepts values from any and all of the
background-color, background-image, background-attachment,
background-repeat
, and
background-position
properties, in any order. If
you do not specify values for some of the properties, those properties
are explicitly set to their default values. Thus:
background: red
sets the
background-color
property to red and resets the other back-
ground properties to their default values. A more complex example:
background: url(backgrounds/marble.gif) blue repeat-y fixed center