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
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-repeat property can also be used with multiple background images (i.e. if you specify multiple values for the
- Background repeats both horizontally and vertically. Computes to
- Background repeats horizontally only. Computes to
- Background repeats vertically only. Computes to
- Background is not repeated. Computes to
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.
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-positionproperty 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
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.
- Initial Value
- Applies To
- All elements