CSS background-repeat
Property
Topic: CSS3 Properties ReferencePrev|Next
Description
The background-repeat
CSS property specifies whether the background-image
is repeated or tiled after it has been sized and positioned, and how. It is often more convenient to use the shorthand background property.
The following table summarizes the usages context and the version history of this property.
Default value: | repeat |
---|---|
Applies to: | All elements |
Inherited: | No |
Animatable: | No. See animatable properties. |
Version: | CSS 1, 2, 3 |
Syntax
The syntax of the property is given with:
The example below shows the background-repeat
property in action.
Example
Try this code »body {
background-image: url("images/gradient.png");
background-repeat: repeat-x;
}
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
repeat |
The default value. The background image will be repeated both vertically and horizontally. |
repeat-x |
The background image will be repeated horizontally only. |
repeat-y |
The background image will be repeated vertically only. |
no-repeat |
The background image will not be repeated. |
initial |
Sets this property to its default value. |
inherit |
If specified, the associated element takes the computed value of its parent element background-repeat property. |
Browser Compatibility
The background-repeat
property is supported in all major modern browsers.
Basic Support—
|
Further Reading
See tutorial on: CSS Background, CSS3 Background.
Related properties: background
, background-attachment
, background-color
, background-clip
, background-image
, background-origin
, background-position
, background-size
.