CSS / Reference / background-repeat: Tiling, Space, and Round
CSS background-repeat sets how a background image tiles. Use no-repeat for a single image, repeat-x to tile horizontally, or repeat-y to tile vertically. To avoid cut tiles, compare space, which leaves gaps between images, and round, which resizes the tiles.
Choose a repeat value and direction
| Value | What it does |
|---|---|
repeat |
Repeats on both axes. This is the initial value and it can cut tiles at the edges. |
repeat-x / repeat-y |
Repeats only horizontally or only vertically. |
no-repeat |
Paints one tile without repetition. |
space |
Fits whole tiles and distributes leftover space between them. |
round |
Resizes tiles to fit a whole number of copies. |
With two values, the first applies horizontally and the second vertically. For example, repeat no-repeat is equivalent to repeat-x. space no-repeat distributes horizontal gaps and paints only one row.
W3C specification for background tiling
Compare four values with one tile
Save the complete example as background-repeat-example.html in UTF-8 and open it in a browser. Each box is 220×120px and uses an 80×40px gradient tile. The CSS defines the gradient directly.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Compare four values with one tile</title>
<style>
.tile {
width: 220px;
max-width: 100%;
height: 120px;
background-color: #f7f9fc;
background-image: linear-gradient(125deg, #254aa5 48%, #9ce5cc 48% 75%, #dbeafe 75%);
background-size: 80px 40px;
background-position: left top;
}
.single { background-repeat: no-repeat; }
.repeat { background-repeat: repeat; }
.space { background-repeat: space; }
.round { background-repeat: round; }
</style>
</head>
<body>
<p>no-repeat</p>
<div class="tile single"></div>
<p>repeat</p>
<div class="tile repeat"></div>
<p>space</p>
<div class="tile space"></div>
<p>round</p>
<div class="tile round"></div>
</body>
</html>
no-repeat leaves one tile in the upper left. repeat cuts the last tile at the right edge. space reveals the background color between columns, and round narrows the tiles to fill the width. To isolate the effect, change only the repeat value and keep the box and tile dimensions the same.
How space and round differ
With space, two 80px tiles touch the horizontal edges and leave a 60px gap. If fewer than two copies fit on an axis, the browser paints one and uses background-position on that axis. Set the width to 140px and the position to right top to see one tile per row against the right edge.
With round, 220 ÷ 80 gives 2.75, rounded to three copies. Each becomes about 73.33px wide. Three 40px rows already fit the height, so their size stays the same. Independent adjustments along the two axes can change the image’s proportions.
Set repetition for several background layers
When you list background images with commas, the first is the top layer. List their background-repeat values in the same order.
.card {
background-image:
radial-gradient(circle, #b45309 40%, transparent 42%),
linear-gradient(135deg, #eff6ff 50%, #dbeafe 50%);
background-size: 32px 32px, 64px 64px;
background-repeat: no-repeat, repeat;
}
The example paints the small circle once and tiles the diagonal pattern below it. If you provide only one repeat value, it is reused for every layer. List separate values when the layers need different behavior.
When the background repeats unexpectedly
If the direction looks right but the tile count does not, check background-size and the box width in DevTools. A size such as cover can leave no visible room for repeated copies.
A later background shorthand can reset repetition to repeat if it leaves the setting out. Put no-repeat or your chosen value in that shorthand, or set background-repeat after it.
For details on sizing each tile, see CSS background-size.





