Web Design

(Nancy Kaufman) #1

112


Control Background Image Tiling .............................


● When viewed in a browser,
the image either repeats
horizontally, vertically, or
not at all.

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

2 Within the declaration,
type background-
repeat: ?, replacing?
with either repeat-x,
repeat-y, or
no-repeat.

Control Background Image Tiling


B


y default, background images tile both horizontally and vertically. The background-repeat
property allows you to control this behavior. A value of repeat-x causes the image to only tile

horizontally; repeat-y creates a vertical tile, and no-repeat prevents tiling altogether. If you


can use an image with a transparent background, the background color of the page shows through


the transparent areas of the image. You may want to set a background color on the page even if the


image is not transparent as a fallback in case the image fails to load.


2


1

Free download pdf