HTML and CSS Reference
In-Depth Information
ages, or the horizontal position ( left , right , center ), or the vertical position ( top ,
bottom , center ) or both the horizontal and vertical position. Here are some valid settings
for this property:
Upper right
0% 100%
top right
right top
50% 50%
center center
Bottom center
50% 100%
bottom center
center bottom
Here's a <body> tag that places the background in the center right of the window and
does not scroll it with the page:
<body style=“background-image: url(backgrounds/rosemarble.gif);
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center right”>
Instead of using all these different properties to specify the background, you can use the
background property by itself to specify all the background properties. With the back-
ground property, you can specify the background color, image, repeat setting, attach-
ment, and position. All the properties are optional, but they must appear in a specific
order. Here's the structure of the property:
background: background-color background-image background-repeat background-
attachment background-positi on;
To condense the preceding specification into one property, the following tag is used:
< body style = “background: url(backgrounds/rosemarble.gif)
no-repeat fixed center right” >
If you like, you can also include a background color. Here's what the new tag looks like:
< body style = “background: #000 url(backgrounds/rosemarble.gif)
no-repeat fixed center right”>
Search WWH ::

Custom Search