CSS PROPERTIES
Expand All|Collapse All
CSS AT-RULES
SPONSORED LINKS

CSS background-repeat Property

Topic: CSS3 Properties Reference« Prev|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:

background-repeat: 
repeat | repeat-x | repeat-y | no-repeat | initial | inherit

The example below shows the background-repeat property in action.

  • 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.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 4+
  • Apple Safari 1+
  • Opera 3.5+

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.

 
Close

Your Feedback:

 

We would love to hear from you! Please say something.