CSS border-image-repeat Property

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

Definition and Usage

The border-image-repeat property controls how the edge slices of a border-image fill each side: stretch them, tile them, scale tiles to fit (round), or leave gaps between tiles (space).

It only affects a painted border image. You need a source and a slice first. The middle area of the box is filled only when border-image-slice includes fill.

Baseline · Widely available.

Not deprecated and not experimental. Available across browsers since March 2016. The space keyword landed later in some engines (Chrome 56+, Firefox 50+).

CSS Syntax

syntax.css
border-image-repeat: stretch | repeat | round | space | initial | inherit;

One value sets all sides. Two values: first is top, middle, and bottom; second is left and right. Example: border-image-repeat: round stretch;.

Property Values

ValueDescriptionTry it
stretchDefault. Scales each edge slice to fill that sideTry it
repeatTiles the edge slice. A partial tile may be clippedTry it
roundTiles the edge, then scales tiles so they fit with no clippingTry it
spaceTiles the edge and puts equal gaps between whole tilesTry it
Two valuesFirst: top / middle / bottom. Second: left / rightTry it
initialResets to the default value, stretchTry it
inheritInherits this property from the parent elementTry it

How to Use border-image-repeat

Set up a border image, then choose how its edge slices fill each side.

  1. Give the element a non-zero border-width (for example border: 20px solid;).
  2. Apply a border image with border-image or the source and slice longhands.
  3. Set border-image-repeat to stretch, repeat, round, or space. It is not inherited.
  4. Use two values when horizontal and vertical edges should behave differently.
PieceRequired?Role
Border widthYesGives the image area thickness
Border imageYesSource plus slice (or the shorthand)
Repeat keywordOptionalDefaults to stretch if omitted
fill on sliceOnly for centerNeeded if you want the middle region filled too

Live Preview

A striped border image. Change border-image-repeat and watch how the edge pattern fills the sides.

Stripes make tiling and stretching easy to see. Default is stretch.

Edges

border-image-repeat: stretch

CSS Examples

Each snippet adds only what border-image-repeat needs: a border, a sliced image, and a repeat keyword. Use Try It Yourself for a live editor.

Example 1 — Stretch (Default)

Scale the edge pattern so it fills each side in one piece.

CSS
<style>
  div {
    border: 20px solid;
    border-image: repeating-linear-gradient(
      45deg, #2563eb 0 8px, #fbbf24 8px 16px
    ) 8;
    border-image-repeat: stretch;
    padding: 12px;
  }
</style>

<div>stretch</div>
Try It Yourself

How It Works

  1. Reserve a border. border: 20px solid; gives the image room to paint.
  2. Add a striped image. The repeating gradient is sliced at 8 so each edge has a pattern.
  3. Stretch the edges. border-image-repeat: stretch scales that pattern to the full length of each side.
  4. This is the default. Omitting the property looks the same as stretch.

Example 2 — Round

Tile the edge pattern, then scale tiles so they fit evenly with no clipping.

CSS
<style>
  div {
    border: 20px solid;
    border-image: repeating-linear-gradient(
      45deg, #2563eb 0 8px, #fbbf24 8px 16px
    ) 8;
    border-image-repeat: round;
    padding: 12px;
  }
</style>

<div>round</div>
Try It Yourself

How It Works

  1. Same border image setup. Width, source, and slice stay the same as the stretch example.
  2. Switch to round. border-image-repeat: round tiles the edge pattern along each side.
  3. Fit whole tiles. The browser scales those tiles slightly so a whole number fits — nothing is clipped off at the end.
  4. Compare with repeat. repeat would keep tile size fixed and clip the last partial tile instead.

Example 3 — Different Axes

Round on the vertical axis, stretch on the horizontal axis.

CSS
<style>
  div {
    border: 20px solid;
    border-image: repeating-linear-gradient(
      45deg, #059669 0 8px, #fff 8px 16px
    ) 8;
    border-image-repeat: round stretch;
    padding: 12px;
  }
</style>

<div>round stretch</div>
Try It Yourself

How It Works

  1. Use two keywords. round stretch is a two-value form of the property.
  2. First value. round applies to the top, middle, and bottom edges.
  3. Second value. stretch applies to the left and right edges.
  4. Mixed look. Vertical edges tile evenly; horizontal edges scale as one continuous piece.

Edge Cases & Pitfalls

If every keyword looks the same, one of these is usually why.

image

No border image, no visible change

Repeat only reshapes edge slices. Set border-image (or source plus slice) before you compare keywords.

pattern

A flat color hides the difference

A solid or simple gradient edge can look identical under stretch and round. Use a striped or tiled source when you are learning the keywords.

repeat

repeat may clip; round scales

If the side length is not a multiple of the tile, repeat cuts the last tile. round resizes tiles so they fit whole.

fill

Center fill needs fill on slice

Repeat also covers the middle region when it is shown. Add fill to border-image-slice if you want that center painted.

reset

border resets the image

The border shorthand sets border-image back to none. Declare the image and repeat after border.

Browser Support

border-image-repeat is a browser CSS property for decorative borders. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

border-image-repeat

stretch and repeat: Chrome 15+, Firefox 15+, Safari 6+, Edge 12+, IE 11. round: Chrome 30+, Safari 9.1+. space: Chrome 56+, Firefox 50+, Safari 9.1+.

97% Global support
Google Chrome 15+ · space 56+
Full support
Mozilla Firefox 15+ · space 50+
Full support
Apple Safari 6+ · round/space 9.1+
Full support
Microsoft Edge 12+
Full support
Opera 15+ · space 43+
Full support
Samsung Internet 1.0+ · space 6+
Full support
Internet Explorer 11
Full support
border-image-repeat Widely supported

Bottom line: Safe for stretch, repeat, and round in current browsers. Prefer stretch or round when you need the widest reach; test space in older Chromium and Firefox. It is not a runtime API.

Key Takeaways

  • Role: how border-image edge slices fill each side — stretch, tile, round, or space.
  • Default: stretch. Not inherited.
  • repeat vs round: clip partial tiles vs scale tiles to fit whole.
  • Two values: first = top/middle/bottom; second = left/right.

One line: border-image-repeat decides how edge slices fill the sides — after you have a border image to tile or stretch.

Frequently Asked Questions

It controls how the edge slices of a border image fill each side: stretch to fit, tile with clipping, tile with scaling (round), or tile with gaps (space).
The initial value is stretch. Edge regions scale to fill the full length of each side.
repeat tiles the edge and may clip a partial tile at the end. round also tiles, but scales the tiles so a whole number of them fits with no clipping.
Yes. With two values, the first applies to the top, middle, and bottom; the second applies to the left and right.
You need a border image first (border-image or source plus slice) and a non-zero border width. Without an image, there are no edge tiles to stretch or repeat.
It is Baseline Widely available. stretch and repeat work from Chrome 15, Firefox 15, and Safari 6. round needs Chrome 30+ and Safari 9.1+. space needs Chrome 56+, Firefox 50+, and Safari 9.1+. It is a browser CSS property, not a Node.js feature.

Next: border-image-slice

Learn how the source image is divided into edges, corners, and fill.

border-image-slice 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