Prev | Current Page 447 | Next

Tommy Olsson and Paul O'Brien

"The Ultimate CSS Reference"


A length value (p. 29) places the top-left corner of the background-image at the
exact horizontal and vertical position specified.
Note that when the background-position is defined with a percentage value, that
position refers to both the element itself and the corresponding point on the
background-image. For example, a background-image with background-position
values of 50% 50% will place the point of the image that??™s located at 50% of the
image??™s width and 50% of the image??™s height at a corresponding position within
the element that contains the image. In the above case, this causes the image to be
307 Color and Backgrounds
perfectly centered. This is an important point to grasp??”using background-position
isn??™t the same as placing an element with absolute position using percentages where
the top-left corner of the element is placed at the position specified.
background-position and background-attachment
If the background-image has been placed using a fixed background-attachment
value, the background-position refers to the viewport, rather than the element??™s
padding box.


Pages:
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459