CSS border-image-source Property

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

Definition and Usage

The border-image-source property sets the image or gradient used as an element’s border artwork. It is the first piece of a border image: choose the source, then cut it with border-image-slice.

The value is none or any CSS <image> — typically url() or a linear-gradient(). When the source is none, the ordinary border-style frame shows instead.

Baseline · Widely available.

Not deprecated and not experimental. Available across browsers since July 2015. A source alone is not enough — you still need a border width and a slice.

CSS Syntax

syntax.css
border-image-source: none | <image> | initial | inherit;

Common <image> forms: url("frame.png"), linear-gradient(...), repeating-linear-gradient(...).

Property Values

ValueDescriptionTry it
noneDefault. No border image; the normal border-style showsTry it
url()An image file (PNG, SVG, WebP, and similar) used as the frameTry it
<gradient>A CSS gradient as the source, with no image file neededTry it
Other <image>Any valid image value, such as repeating-linear-gradient()Try it
initialResets to the default value, noneTry it
inheritInherits this property from the parent elementTry it

How to Use border-image-source

Pick the artwork, give the border some width, then slice the source so corners and edges look right.

  1. Set a non-zero border-width (for example border: 20px solid;).
  2. Set border-image-source to a url() or a gradient. It is not inherited.
  3. Set border-image-slice so the browser knows how to cut the source.
  4. Or use the border-image shorthand to set source and slice together.
PieceRequired?Role
Border widthYesGives the image area thickness
SourceYesThe image or gradient to paint
SliceUsuallyCuts the source into corners and edges
Repeat / width / outsetOptionalFine-tune how the sliced regions fill the sides

Live Preview

Change border-image-source and watch the frame switch between an image, a gradient, and no image.

With none, the solid border-style shows. Slice stays at 30 for every image source.

Source

border-image-source: url(…)

CSS Examples

Each snippet focuses on border-image-source, plus the border width and slice it needs to show. Use Try It Yourself for a live editor.

Example 1 — Image URL

Use a PNG (or SVG) file as the border artwork.

CSS
<style>
  div {
    border: 30px solid;
    border-image-source: url("/images/apple.png");
    border-image-slice: 30;
    padding: 12px;
  }
</style>

<div>image source</div>
Try It Yourself

How It Works

  1. Reserve a border. border: 30px solid; gives the image a place to paint.
  2. Point at the file. border-image-source: url(...) loads the artwork.
  3. Cut the artwork. border-image-slice: 30 divides it into corners and edges.
  4. Paint the frame. Those regions replace the ordinary solid border color.

Example 2 — Gradient Source

Use a CSS gradient so you do not need an image file.

CSS
<style>
  div {
    border: 16px solid;
    border-image-source: linear-gradient(135deg, #2563eb, #dc2626);
    border-image-slice: 1;
    padding: 12px;
  }
</style>

<div>gradient source</div>
Try It Yourself

How It Works

  1. Set a border width. The gradient needs thickness to show as a frame.
  2. Use a gradient as the source. linear-gradient(...) is a valid <image>.
  3. Slice at 1. For a simple gradient, border-image-slice: 1 is a common choice so the whole gradient becomes the border area.
  4. No file download. The browser draws the gradient itself — useful for quick decorative borders.

Example 3 — None (Fallback)

Turn the border image off and show a normal solid border.

CSS
<style>
  div {
    border: 4px solid #0f172a;
    border-image-source: none;
    padding: 12px;
  }
</style>

<div>no image source</div>
Try It Yourself

How It Works

  1. Keep a normal border. Width, style, and color are set on border.
  2. Set the source to none. That is also the initial value of the property.
  3. No image is painted. Slice and repeat do not apply when there is no source.
  4. Fallback appearance. You see the ordinary solid line defined by border-style.

Edge Cases & Pitfalls

If the frame is missing or looks wrong, check these first.

width

Source alone is not enough

You need a non-zero border-width and usually a border-image-slice. Source only picks the artwork.

path

Broken url() looks like no image

A wrong path or failed load leaves you with the ordinary border (or nothing useful). Check the Network tab for a 404.

none

none restores the normal border

With border-image-source: none, border-style paints again. That is the default until you set a source.

reset

border resets the image

The border shorthand sets border-image back to none. Declare the source (and slice) after border.

slice

Gradients still need a slice

A gradient source without a sensible slice can look empty or odd. Start with border-image-slice: 1 for simple gradients.

Browser Support

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

✓ Baseline · Widely available

border-image-source

Chrome 15+, Firefox 15+, Safari 6+, Edge 12+, Internet Explorer 11+. Gradients as sources work in all modern browsers.

97% Global support
Google Chrome 15+
Full support
Mozilla Firefox 15+
Full support
Apple Safari 6+
Full support
Microsoft Edge 12+
Full support
Opera 15+
Full support
Samsung Internet 1.0+
Full support
Internet Explorer 11
Full support
border-image-source Widely supported

Bottom line: Safe for production image and gradient frames. Pair the source with width and slice. It is not a runtime API.

Key Takeaways

  • Role: choose the image or gradient that becomes the border artwork.
  • Default: none. Not inherited. Falls back to normal border-style.
  • Needs partners: border width and usually border-image-slice.
  • Gradients count: any CSS <image>, including gradients, can be the source.

One line: border-image-source picks the artwork — then slice (and width) turn that artwork into a frame.

Frequently Asked Questions

It sets the image or gradient used as the border artwork. border-image-slice then divides that source into corners and edges.
The initial value is none. No border image is used, so the element shows its normal border-style instead.
Yes. Any CSS <image> works, including url(), linear-gradient(), and repeating-linear-gradient(). Gradients are a simple way to make a colorful frame without a file.
No. You also need a non-zero border-width and usually border-image-slice so the browser knows how to cut and paint the source.
The border image is turned off. The box falls back to the ordinary border drawn by border-style, border-width, and border-color.
It is Baseline Widely available: Chrome 15+, Firefox 15+, Safari 6+, Edge 12+, and Internet Explorer 11. It is a browser CSS property, not a Node.js feature.

Next: border-image-width

Control how thick the sliced border image is drawn on each side.

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