CSS background-repeat Property

Beginner
7 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The background-repeat property sets how each background-image tiles inside the painting area. The image can repeat on both axes, only one axis, or not at all. space leaves even gaps. round stretches copies so they fit without gaps.

The initial value is repeat. The property is not inherited. One keyword can cover both axes. Two keywords set horizontal first, then vertical. With several images, list a repeat value for each image, separated by commas. background-position places a single no-repeat image.

Standard.

Not deprecated. repeat, no-repeat, repeat-x, repeat-y, space, and round are Baseline. Logical values such as repeat-block and repeat-inline are newer and still limited.

CSS Syntax

syntax.css
background-repeat: repeat | no-repeat | repeat-x | repeat-y | space | round | initial | inherit;

Two keywords set axes separately, such as repeat no-repeat (same as repeat-x). Separate multiple images with commas.

Property Values

ValueDescriptionTry it
repeatTiles both axes. Edge copies may be clipped. This is the initial valueTry it
no-repeatShows one copy. Place it with background-positionTry it
repeat-xTiles only horizontally. Same as repeat no-repeatTry it
repeat-yTiles only vertically. Same as no-repeat repeatTry it
spaceTiles without clipping. Even gaps sit between copiesTry it
roundTiles without gaps. Copies may stretch to fit the boxTry it
repeat no-repeatTwo-value form: horizontal, then verticalTry it
initialResets this property to repeatTry it
inheritCopies this property from the parent elementTry it

How to Use background-repeat

Give the element an image and a size, then choose how that image tiles.

  1. Set a background-image on the element. Without an image, repeat has nothing to tile.
  2. Give the element a visible size. Content or a height is enough.
  3. Optionally set background-size so each tile has a clear size.
  4. Set background-repeat. Use no-repeat with background-position when you want one placed image.
PieceRequired?Role
background-imageYesThe picture or gradient that tiles
A visible boxYesContent or a height, so the tiles have somewhere to show
background-repeatYesHow the image tiles on each axis
background-sizeOftenThe size of each tile. Helps space and round read clearly
background-positionFor no-repeatWhere the single image sits

Live Preview

One small blue tile. Change background-repeat and watch how it fills the box.

The tile size stays the same. Only the repeat mode changes.

Repeat

background-repeat: repeat

CSS Examples

Each snippet adds only what background-repeat needs: an image, a tile size, and a sized box. Use Try It Yourself for a live editor.

Example 1 — One Image

Show a single tile in the middle. Nothing else fills the box.

CSS
<style>
  div {
    height: 160px;
    border: 1px solid #ccc;
    background-color: #eff6ff;
    background-image: radial-gradient(circle, #2563eb 0 8px, transparent 9px);
    background-size: 40px 40px;
    background-position: center;
    background-repeat: no-repeat;
  }
</style>

<div></div>
Try It Yourself

How It Works

  1. Make a box. height: 160px and the border give the image a clear area.
  2. Define one tile. The radial gradient is a small blue circle. background-size: 40px 40px sets that tile's size.
  3. Stop tiling. background-repeat: no-repeat draws the image once.
  4. Place it. background-position: center puts that one copy in the middle. Without position, it would sit at the top left.

Example 2 — Horizontal Row

Tile left to right only. The vertical axis stays a single row.

CSS
<style>
  div {
    height: 160px;
    border: 1px solid #ccc;
    background-color: #eff6ff;
    background-image: radial-gradient(circle, #2563eb 0 8px, transparent 9px);
    background-size: 40px 40px;
    background-position: center;
    background-repeat: repeat-x;
  }
</style>

<div></div>
Try It Yourself

How It Works

  1. Same tile. The circle and 40px size match the first example.
  2. Repeat on X only. repeat-x is shorthand for repeat no-repeat: horizontal tiles, one vertical row.
  3. Center the row. background-position: center keeps that row in the vertical middle.
  4. Edges may clip. If the box width is not a multiple of 40px, the last horizontal tile can be cut off. That is normal for repeat and repeat-x.

Example 3 — Even Gaps

Tile as many full copies as fit, and put equal space between them.

CSS
<style>
  div {
    height: 160px;
    border: 1px solid #ccc;
    background-color: #ecfdf5;
    background-image: radial-gradient(circle, #059669 0 8px, transparent 9px);
    background-size: 40px 40px;
    background-repeat: space;
  }
</style>

<div></div>
Try It Yourself

How It Works

  1. Fit whole tiles only. space does not clip edge copies the way repeat does.
  2. Pin the first and last. Copies sit against the edges when more than one fits, and leftover room becomes even gaps.
  3. Position is mostly ignored. With space, the browser places the tiles. background-position matters mainly when only one tile fits.
  4. Compare with round. round also avoids gaps from clipping, but it stretches each tile instead of adding whitespace.

Edge Cases & Pitfalls

If the tiles look clipped, stretched, or missing, one of these is usually why.

clip

repeat can cut the edges

When the box size is not a multiple of the tile size, edge copies are clipped. Use space for whole tiles with gaps, or round for whole tiles that stretch.

round

round can distort the image

It is the only common value that may change the tile aspect ratio so copies fill the box without gaps. Prefer space if you must keep the original proportions.

size

Tile size comes from background-size

A huge image with repeat may look like one copy. Set background-size so each tile is small enough to see the pattern.

position

space mostly ignores position

background-position places a no-repeat image. With space, the browser pins and spaces the tiles unless only one tile fits.

shorthand

The background shorthand resets repeat

A later background: #fff sets every background longhand, including background-repeat: repeat. Set repeat after the shorthand, or include it in the shorthand.

Browser Support

background-repeat is a browser painting property. Node.js, Deno, and Bun do not apply it. Basic keywords are older than space and round. Logical values such as repeat-block are newer.

✓ Baseline · Widely available since 2015

background-repeat

repeat, no-repeat, repeat-x, repeat-y: every current browser and IE 4+. space and round: Chrome 30+, Firefox 49+, Safari 7+, Edge 12+. Multiple backgrounds: IE 9+.

99% Core keywords
Google Chrome 1+ · 30+ space/round
Full support
Mozilla Firefox 1+ · 49+ space/round
Full support
Apple Safari 1+ · 7+ space/round
Full support
Microsoft Edge 12+
Full support
Opera 3.5+ · 17+ space/round
Full support
Samsung Internet 1+
Full support
Internet Explorer 4+ · no space/round
Partial
background-repeat Widely supported

Bottom line: Safe for repeat, no-repeat, repeat-x, and repeat-y everywhere. Use space and round freely in current browsers; they are missing in Internet Explorer. Prefer physical keywords over repeat-block / repeat-inline on a normal page.

Key Takeaways

  • Role: choose how each background image tiles — both axes, one axis, or not at all.
  • Values: repeat, no-repeat, repeat-x, repeat-y, space, and round.
  • Initial value: repeat. It is not inherited.
  • Gaps vs stretch: space adds gaps; round may stretch tiles to avoid gaps.

One line: background-repeat decides whether the image tiles — after you have an image, and often after you set a clear tile size.

Frequently Asked Questions

It sets how each background image tiles inside the painting area. The image can repeat on both axes, only horizontally, only vertically, or not at all. space and round control gaps and stretching. The initial value is repeat.
repeat, which means repeat on both axes. Edge tiles may be clipped if the box size is not a multiple of the image size. The property is not inherited.
no-repeat shows one copy. repeat-x tiles only left to right. repeat-y tiles only top to bottom. Use background-position to place a single no-repeat image.
space tiles without clipping and puts even gaps between copies. round tiles without gaps and may stretch each copy so they fit the box evenly. round is the value that can change the image aspect ratio.
Yes. Two keywords set horizontal first, then vertical, such as repeat no-repeat. That is the long form of repeat-x. With several images, list a repeat value for each image, separated by commas.
repeat, no-repeat, repeat-x, and repeat-y work in every current browser and in old Internet Explorer. space and round need Chrome 30, Firefox 49, Safari 7, or Edge 12. This is a browser CSS property. Node.js, Deno, and Bun do not paint it.

Next: background-size

Learn how to scale each background tile with cover, contain, or lengths.

background-size tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful