CSS border-image-source Property

Beginner
⏱️ 7 min read
📚 Updated: Jun 2026
🎯 4 Examples
Box Model & Layout

What You’ll Learn

The border-image-source property chooses the image or gradient that becomes your element’s border artwork.

01

Image URLs

PNG, JPG, SVG.

02

Gradients

Linear and radial.

03

none

Disable image border.

04

Longhand

Part of border-image.

05

With slice

Needs companion props.

06

Decorative

Frames and patterns.

Definition and Usage

The border-image-source CSS property sets which image or gradient is used as the source for a border image. It is a longhand of the border-image shorthand and defines the artwork before slicing, repeating, and sizing are applied.

With border-image-source, you can move beyond plain solid, dashed, or dotted borders and use decorative frame images or colorful gradients. The source alone does not paint the border — you also need a border width and typically a border-image-slice value.

💡
Beginner Tip

Think of border-image-source as picking the wallpaper for a picture frame. You still need to decide how thick the frame is (border width) and how to cut the wallpaper into pieces (border-image-slice).

Where Source Fits in border-image

border-image-source border-image-slice border-image-width border-image-repeat

📝 Syntax

border-image-source accepts an image URL, a gradient, or none:

syntax.css
selector {
  border-image-source: url("image.jpg") | <gradient> | none;
}

Basic Example

border-image-source.css
div {
  width: 300px;
  height: 200px;
  border: 10px solid transparent;
  border-image-source: url("border-image.png");
  border-image-slice: 30;
}

Syntax Rules

  • Use url() to reference PNG, JPEG, WebP, GIF, or SVG image files.
  • CSS gradients such as linear-gradient() and radial-gradient() are valid sources.
  • none disables the border image and restores normal border painting.
  • Always pair with a visible border-width (often via border: 10px solid transparent).
  • Set border-image-slice so the browser knows how to divide the source.

⚡ Quick Reference

QuestionAnswer
Initial valuenone
Applies toBorder image artwork selection
InheritedNo
AnimatableNo
Common useDecorative frames, gradient borders, themed UI cards

Default Value

The default value of border-image-source is none. When set to none, no image border is used and the element falls back to the standard border-style, border-width, and border-color properties.

💎 Property Values

ValueExampleMeaning
url()border-image-source: url("frame.png");Uses an external image file as the border artwork
Gradientborder-image-source: linear-gradient(...);Creates a gradient-based border without an image file
noneborder-image-source: none;Disables border image and uses normal border properties

Common Value Types

url(...)image file
linear-gradient(...)gradient source
nonenormal border

border-image-source vs related properties

PropertyTargetsBest for
border-image-sourceWhich image or gradient to useChoosing border artwork
border-image-sliceHow the source is dividedCutting frame corners and edges
background-imageElement background areaContent behind the element, not the border ring
border-imageFull border image shorthandSetting source, slice, width, outset, and repeat together

👀 Live Preview

A box using an image as its border source:

Uses border-image-source: url("/images/apple.png"); with border-image-slice: 30;.

Examples Gallery

Try border-image-source with image URLs, gradients, and the none value.

📚 Image and Gradient Sources

Set the artwork that becomes your border image.

Example 1 — Image URL Source

Use an image file as the border source, matching the reference tutorial example.

border-image-source-url.html
<style>
  div {
    width: 300px;
    height: 200px;
    border: 10px solid transparent;
    border-image-source: url("border-image.png");
    border-image-slice: 30;
  }
</style>

<div></div>
Try It Yourself

How It Works

border-image-source points to the image file. Combined with a border width and slice value, the browser maps regions of that image to the element’s border edges.

Example 2 — Linear Gradient Source

Use a CSS gradient instead of an image file for a colorful border.

border-image-source-linear.css
.card {
  border: 4px solid transparent;
  border-image-source: linear-gradient(135deg, #2563eb, #7c3aed);
  border-image-slice: 1;
  padding: 1rem;
  background: #fff;
}
Try It Yourself

How It Works

Gradients are valid border image sources. A slice of 1 is a common pattern for gradient borders because it divides the gradient cleanly across the border area.

🎨 More Source Options

Radial gradients and disabling the border image.

Example 3 — Radial Gradient Source

Create a circular color transition as the border artwork.

border-image-source-radial.css
.badge {
  border: 6px solid transparent;
  border-image-source: radial-gradient(circle, #f59e0b, #ef4444);
  border-image-slice: 1;
  padding: 0.75rem 1rem;
  background: #fff;
  border-radius: 999px;
}
Try It Yourself

How It Works

radial-gradient() works the same way as a linear gradient source. The gradient is sliced and painted around the border area of the element.

Example 4 — none Value

Disable the border image and fall back to a standard solid border.

border-image-source-none.css
.panel {
  border: 3px solid #2563eb;
  border-image-source: none;
  padding: 1rem;
  background: #fff;
}
Try It Yourself

How It Works

When border-image-source is none, the browser ignores border-image painting and uses your normal border properties instead.

🧠 How border-image-source Works

1

You set a source

Choose an image URL or gradient with border-image-source.

Source
2

Border width reserves space

A visible border width defines how thick the image border will be.

Width
3

Slice divides the artwork

border-image-slice cuts the source into corners and edges.

Slice
=

Decorative border painted

The chosen source appears as a custom border around the element.

Modern Browser Support

The border-image-source property is supported in all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera.

Baseline · Modern browsers

Border image sources in today’s browsers

Image URLs and CSS gradients both work as border-image-source values in current browser versions.

96% Modern browser support
Google Chrome15+ · Desktop & Mobile
Full support
Mozilla Firefox15+ · Desktop & Mobile
Full support
Apple Safari6+ · macOS & iOS
Full support
Microsoft Edge12+ · All versions
Full support
Opera15+ · Modern versions
Full support
border-image-source property 96% supported

Bottom line: Use border-image-source for image and gradient borders in modern projects. Test gradient borders in Safari if you need pixel-perfect results.

Conclusion

The border-image-source property is where border-image styling begins. It lets you choose any image file or CSS gradient as border artwork, opening up decorative frames and colorful gradient borders that standard border properties cannot achieve alone.

Remember to pair it with border width and slice values so the browser can actually paint your chosen source around the element.

💡 Best Practices

✅ Do

  • Use border: 10px solid transparent when applying image borders
  • Set border-image-slice alongside your source
  • Use gradients for lightweight colorful borders without extra HTTP requests
  • Optimize image files used as border sources
  • Design frame artwork with clear corner and edge regions

❌ Don’t

  • Expect border-image-source alone to show a border image
  • Confuse border-image-source with background-image
  • Use huge unoptimized images for small decorative borders
  • Forget to test gradient borders across browsers
  • Leave border-width at zero when using border images

Key Takeaways

Knowledge Unlocked

Five things to remember about border-image-source

Use these points when choosing border artwork.

5
Core concepts
02

Default none

Normal border.

Default
🎨03

url() works

PNG, JPG, SVG.

Values
🌈04

Gradients OK

No image file.

Gradients
🛠05

Needs slice

Not standalone.

Usage

❓ Frequently Asked Questions

The border-image-source property sets the image or gradient used as the border artwork. It is the first step in applying a border-image — you choose what visual source the browser will slice and paint.
The initial value is none, which means no image border is used and the element falls back to normal border-style, border-width, and border-color.
Yes. linear-gradient() and radial-gradient() are valid sources in modern browsers and are a simple way to create colorful borders without an image file.
No. You also need a visible border width and usually border-image-slice so the browser knows how to divide and apply the source.
Common formats like PNG, JPEG, WebP, GIF, and SVG can be used with url() as long as the browser supports the format.

Practice in the Live Editor

Open the HTML editor, try border-image-source, and preview image and gradient borders 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