HTML and CSS Reference
In-Depth Information
Figure 8-11. The background image is attached to the element rather than its content
When I first tested this in a browser, I thought it might be a bug, but it's not. In CSS2.1, the only values
for background-attachment were fixed and scroll . The choice of “scroll” was intended to indicate that the
background scrolls along with the containing block. And to do so, it needs to be fixed to the element rather than
its content.
The easy way to remember the meaning of scroll is that the background remains attached to the element,
but that it scrolls with the rest of the page.
Tip
Controlling the Position of Background Images
By default, browsers place the top-left corner of background images at the top left of the element, and apply the
background to the whole element (unless you restrict it using background-repeat ). However, the background-
position property allows you to specify new offsets for the background image to place it exactly where you want.
CSS3 introduces two other properties: background-origin and background-clip , which give you control over
where the offsets are measured from and how far the background extends
You specify the offsets for background-position using any combination of the following:
Lengths, such as pixels and ems
Keywords
Percentages
Table 8-2 lists the keywords and their percentage equivalents.
 
 
Search WWH ::




Custom Search