CSS GUIDE BACKGROUND REPEAT

From CDOT Wiki
Revision as of 17:54, 14 December 2006 by Elichak (talk | contribs) (Syntax)
Jump to: navigation, search

This document is a work in progress and is subject to change.

Summary

This property sets the background image of an element. When setting a background image, authors should also specify a background color that will be used when the image is unavailable. When the image is available, it is rendered on top of the background color. (Thus, the color is visible in the transparent parts of the image).

Values for this property are either <uri>, to specify the image, or 'none', when no image is used.

BODY { background-image: url("marble.gif") }
P { background-image: none }
Applicability:The background-repeat property can be used for all CSS elements.
Media Group: Visual
Inherited:No

Syntax

If a background image is specified, this property specifies whether the image is repeated (tiled), and how. All tiling covers the content and padding areas of a box. A value of 'repeat' means that the image is repeated both horizontally and vertically. The 'repeat-x' ('repeat-y') value makes the image repeat horizontally (vertically), to create a single band of images from one side to the other. With a value of 'no-repeat', the image is not repeated.:

BODY { 
  background: white url("pendant.gif");
  background-repeat: repeat-y;
  background-position: center;
}

Legal Values

The following units are valid for defining background-repeat:

  • repeat
    • The image is repeated both horizontally and vertically.
  • repeat-x
    • The image is repeated horizontally only.
  • repeat-y
    • The image is repeated vertically only.
  • no-repeat
    • The image is not repeated: only one copy of the image is drawn.


Mozilla Recommended Values

MDC document on background-repeat


Notes

The World Wide Web Consortium (W3C) provides a free online CSS validation service.

Specification Conformance

Browser Compatibility

  • Internet Explorer
  • Firefox
  • Opera