XML technologies / CSS / CSS Cookbook / Images / Repeating background images

(Excerpt from “CSS Kochbuch” by Christopher Schmitt)

Problem

You want to repeat background images vertically or horizontally.

Solution

To repeat a background image horizontally, along the x axis, use the following CSS rule (see the next figure):

body {
 background-image: url(bkgd.jpg);
 background-repeat: repeat-x;
}

Background image repeated horizontally

Figure: The background image is repeated horizontally.

To repeat the background image along the vertical axis, set the property background-repeat to the value repeat-y.

See also

See the recipe Positioning background images for placing a background image at a specific position on a web page.

  

 

 

 

back to top