Web Design

(Nancy Kaufman) #1

113


CHAPTER

4


● When viewed in a browser,
the image is now positioned
at the indicated spot. If the
image is set to tile, it tiles
from that location.

1 In your editor, open a
document that contains an
embedded style sheet and an
existing body declaration and
background-image rule.


2 Within the declaration, type
background-position:
? ?, replacing the first? with
the distance from the top of
the page, and the second with
the distance from the left.


Note: Be sure to include the unit of
measurement you want to use.


Position Background Images ...................................


B


ackground images are initially positioned in the top right corner of the element into which they
are placed, but the background-position property allows you to control this. The property

takes two values, separated by commas: the first the distance from the top edge, the second the


distance from the left. These distances can be set using any valid unit of measurement. If you


set the position using pixels, the image remains in place even if the browser is resized, but using


percentages as the values allows the image to move as the browser scales.


Position Background Images


2


1

Free download pdf