CSS background-repeat Property

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 4 Examples
Backgrounds & Layout

What You’ll Learn

The background-repeat property controls whether a background image tiles across an element. By default, backgrounds repeat in both directions, but you can limit tiling to one axis or turn it off completely.

01

Tiling Basics

Repeat or stop backgrounds.

02

Axis Control

repeat-x and repeat-y.

03

no-repeat

Single background images.

04

space & round

Advanced tiling behavior.

05

Patterns

Build textures and grids.

06

With size

Pair with background-size.

Definition and Usage

The background-repeat CSS property defines how background images are repeated within an element. When a background is smaller than its container, the browser tiles it to fill the area unless you tell it otherwise.

This property is essential for patterns, textures, and decorative tiles. It is equally important for no-repeat layouts where a photo, logo, or icon should appear only once.

💡
Beginner Tip

Most hero sections and card layouts use background-repeat: no-repeat; so the image does not tile unexpectedly.

📝 Syntax

Apply background-repeat after setting a background-image:

syntax.css
selector {
  background-repeat: repeat | repeat-x | repeat-y | no-repeat | space | round;
}

Basic Example

background-repeat.css
.hero {
  background-image: url("photo.jpg");
  background-repeat: no-repeat;
  background-size: cover;
}

Syntax Rules

  • The initial value is repeat, which tiles in both directions.
  • You can set horizontal and vertical repeat separately with two values, such as repeat no-repeat.
  • space and round affect how tiles fit when the area cannot be filled evenly.
  • Repeating only works when the background image is smaller than the element (or when using background-size).
  • Pair with background-size and background-position for full control.

⚡ Quick Reference

QuestionAnswer
Initial valuerepeat
Applies toBackground image tiling behavior
InheritedNo
AnimatableNo
Common usePatterns, textures, single hero images, striped backgrounds

Default Value

The initial value of background-repeat is repeat. That means a background image tiles both horizontally and vertically until the element is covered.

💎 Property Values

These are the keyword values you can use with background-repeat.

ValueExampleMeaning
repeatbackground-repeat: repeat;Tiles the image both horizontally and vertically
repeat-xbackground-repeat: repeat-x;Tiles the image horizontally only
repeat-ybackground-repeat: repeat-y;Tiles the image vertically only
no-repeatbackground-repeat: no-repeat;Shows the background once without tiling
spacebackground-repeat: space;Repeats without clipping and adds space between tiles
roundbackground-repeat: round;Repeats and stretches tiles to fill the area evenly
repeat

Tiles in both directions until the element is filled.

Default tiling behavior.

repeat-x

Creates a horizontal stripe or row pattern.

Horizontal rows only.

repeat-y

Creates a vertical column pattern.

Vertical columns only.

no-repeat

Shows one copy of the background image.

Common for hero images.

space

Repeats tiles with gaps instead of clipping edges.

Even spacing between tiles.

round

Stretches tiles so the area fills without gaps.

Tiles resize to fit.

space vs round

ValueBehaviorBest for
repeatStandard tiling; edges may clipSimple patterns and textures
spaceRepeats without clipping; adds gaps between tilesEvenly spaced icon grids or dot patterns
roundRepeats and resizes tiles to fill the areaBackgrounds that must cover an area without gaps
no-repeatSingle background image onlyPhotos, logos, and hero banners

👀 Live Preview

The same dot pattern with four different repeat values:

repeat
repeat-x
repeat-y
no-repeat

All panels use the same background-size: 24px 24px; dot pattern.

Examples Gallery

Try background-repeat with no-repeat, axis-specific tiling, full repeat patterns, and a six-value comparison.

📚 Common Repeat Modes

Start with the values you will use most often in real layouts.

Example 1 — Single Background with no-repeat

Prevent a background from tiling when you want one image only.

no-repeat.css
.hero {
  background-image: url("photo.jpg");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
}
Try It Yourself

How It Works

no-repeat shows the background once. This is the most common choice for photos and large decorative images.

Example 2 — repeat-x vs repeat-y

Tile a pattern in one direction only to create stripes or columns.

repeat-axes.css
.stripes { background-repeat: repeat-x; }
.columns { background-repeat: repeat-y; }
Try It Yourself

How It Works

repeat-x tiles horizontally in rows. repeat-y tiles vertically in columns.

🎨 Patterns & Advanced Tiling

Use full repeat for textures, and explore space and round for smarter tiling.

Example 3 — Full Pattern with repeat

Tile a small pattern in both directions to cover the entire element.

repeat-pattern.css
.pattern {
  background-image: url("dot.svg");
  background-repeat: repeat;
  background-size: 24px 24px;
}
Try It Yourself

How It Works

This is the default behavior. A small tile repeats horizontally and vertically until the box is filled.

Example 4 — Compare All Repeat Values

See how each keyword changes tiling on the same dot pattern.

repeat-compare.css
.repeat { background-repeat: repeat; }
.space { background-repeat: space; }
.round { background-repeat: round; }
Try It Yourself

How It Works

repeat tiles normally. space adds gaps between tiles. round stretches tiles so the area fills without clipping.

🧠 How background-repeat Works

1

You add a background image

Set an image, gradient, or pattern with background-image.

Background
2

You choose a repeat mode

Use background-repeat to tile in both directions, one axis, or not at all.

Tiling rule
3

You control tile size

Set background-size so each tile is the size you expect before repeating.

Tile size
=

Controlled background coverage

You decide whether the background tiles into a pattern or appears once as a single image.

Universal Browser Support

background-repeat is supported in all modern browsers. Basic values like repeat, repeat-x, repeat-y, and no-repeat have excellent legacy support.

Baseline · All browsers

Reliable background tiling everywhere

Chrome, Firefox, Safari, Edge, and Opera support all common repeat keywords.

99% Modern browser support
Google Chrome1+ · Desktop & Mobile
Full support
Mozilla Firefox1+ · Desktop & Mobile
Full support
Apple Safari1+ · macOS & iOS
Full support
Microsoft Edge12+ · Modern versions
Full support
Opera10.5+ · Modern versions
Full support

Fallback behavior

Older browsers support repeat, repeat-x, repeat-y, and no-repeat. Use those as safe defaults when space or round are not required.

💻
space and round Supported in modern browsers; fall back to repeat if needed
Fallback
background-repeat property 99% supported

Bottom line: Use background-repeat confidently. It is one of the most stable CSS background properties.

Conclusion

The background-repeat property controls whether background images tile and in which directions. It is essential for patterns, textures, and any layout where a single image should not repeat unexpectedly.

Pair it with background-size and background-position for complete background control, or continue to background-size to learn how to resize tiles and hero images.

💡 Best Practices

✅ Do

  • Use no-repeat for photos, logos, and hero banners
  • Set background-size when using small repeating patterns
  • Use repeat-x or repeat-y for striped or column layouts
  • Test patterns at different screen sizes
  • Consider space or round for evenly distributed icon grids

❌ Don’t

  • Forget no-repeat on large images that should appear once
  • Assume a background will not tile by default
  • Use tiny repeating images without setting an explicit tile size
  • Rely on space or round without checking older browser needs
  • Ignore performance when using large tiled background images

Key Takeaways

Knowledge Unlocked

Five things to remember about background-repeat

Use these points when tiling or stopping background images.

5
Core concepts
02

One-Axis Tiling

repeat-x and repeat-y.

Axes
🖼️03

no-repeat

Single image layouts.

Common
📊04

space & round

Smart tiling options.

Advanced
🛠05

With background-size

Control tile dimensions.

Pair

❓ Frequently Asked Questions

The background-repeat property controls whether and how a background image tiles within an element. It can repeat in both directions, one direction, or not at all.
The initial value is repeat, which tiles the background both horizontally and vertically until the element is filled.
Use no-repeat when you want a single background image, such as a hero photo, logo, or decorative icon that should appear only once.
space repeats the image without clipping and adds gaps between tiles. round repeats the image and stretches or shrinks tiles so the area fills without gaps.
Yes. Use repeat-x for horizontal tiling only or repeat-y for vertical tiling only.

Practice in the Live Editor

Open the HTML editor, change repeat values, and see how backgrounds tile instantly.

HTML Editor →

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.

5 people found this page helpful