CSS background-repeat

The CSS background-repeat property is used to specify if a background image repeats (tiles) or not, and how it should repeat.

By default, background images repeat horizontally and vertically across the width and height of the background painting area. However, you can change this behavior with the background-repeat property.

You can stop the image from repeating altogether (so that it only appears once), or you can specify exactly how it repeats, especially when also using the background-position and/or the background-size property.

The background-repeat property can also be used with multiple background images (i.e. if you specify multiple values for the background-image property).



Possible Values

Background repeats both horizontally and vertically. Computes to repeat repeat.
Background repeats horizontally only. Computes to repeat no-repeat.
Background repeats vertically only. Computes to no-repeat repeat.
Background is not repeated. Computes to no-repeat no-repeat.

Computes to round round.

The image is repeated as often as will fit within the background positioning area. If it doesn't fit a whole number of times, it is rescaled so that it does. If the background painting area is larger than the background positioning area, then the pattern repeats to fill the background painting area.


Computes to space space.

The image is repeated as much as possible to fit within the background positioning area without being clipped. The first and last images touch the edges of the area, and whitespace is distributed evenly between the images. The background-position property is ignored unless only one image can be displayed without clipping. The only case where clipping happens using space is when there's not enough room to display one image.

In addition, all CSS properties also accept the following CSS-wide keyword values as the sole component of their property value:

Represents the value specified as the property's initial value.
Represents the computed value of the property on the element's parent.
This value acts as either inherit or initial, depending on whether the property is inherited or not. In other words, it sets all properties to their parent value if they are inheritable or to their initial value if not inheritable.

General Information

Initial Value
Applies To
All elements

Example Code

Official Specifications