CSS background-repeat

The background-repeat property repeats a background image.

Options include: repeat horizontally, vertically, tiled, or never.



A background image that repeats horizontally.

  .bg-x-repeat {
    background-image: url("/img/css/cardplayers.jpg");
    background-repeat: repeat-x;
    height: 300px;

<div class="bg-x-repeat"></div>

Using background-repeat

The background-repeat property accepts two values for horizontal and vertical repeat.

Specifying one value is treated as both repeat behaviors.


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



Value Description
repeat Default. Repeats background image vertically and horizontally
repeat-x Repeats background image horizontally
repeat-y Repeats background image vertically
no-repeat Does not repeat background image
space Repeats background image without clipping
round Repeats background image and scales them to fill the entire space
initial Sets the value to its default value.
inherit Inherits the value from its parent element.

More Examples

Click the buttons to see the different background-repeat values.

  .bg-example {
    background-image: url("/img/css/cardplayers.jpg");
    background-repeat: repeat;
    height: 400px;

<div class="bg-example"></div>

Browser support

This table shows when background-repeat support started for each browser.

1.0 Dec 2008
1.0 Nov 2004
4.0 Sep 1997
3.5 Nov 1998
1.0 Jun 2003

You may also like

Last updated on Sep 30, 2023