background-repeat
Whether the background image repeats to fill the block.
Syntax
background-repeat: value;Values
| Parameter | Type | Description |
|---|---|---|
| repeat | keyword | Tiles in both directions (the default). |
| no-repeat | keyword | Shown once. |
| repeat-x | repeat-y | keyword | Repeats only horizontally or only vertically. |
Examples
Polka dots in all directions and in one row:
<style>
.tiles {
height: 100px;
background-image: radial-gradient(circle, tomato 30%, transparent 32%);
background-size: 25px 25px;
}
</style>
<div class="tiles" style="background-repeat: repeat;"></div>
<p></p>
<div class="tiles" style="background-repeat: repeat-x;"></div>Notes
A photo usually needs no-repeat: otherwise, in a block larger than the picture, it repeats at the edges.
See also
- background-image — One or more background images: files or gradients.
- background-size — The size of a background image.
Related recipes
In the tutorial
- Backgrounds and borders — Background images, their repeat, size and position, border styles, rounded corners and outline.