The border-image-slice property divides a border image into nine regions — four corners, four edges, and a center — so the browser can map each part to the element border.
01
Nine Regions
Corners and edges.
02
Numbers
Image coordinates.
03
Percentages
Relative to image.
04
fill Keyword
Keep center slice.
05
Four Values
Per-side insets.
06
border-image
Longhand property.
Fundamentals
Definition and Usage
The border-image-slice CSS property controls how a source image is divided before it is applied as a border. Inset lines are drawn from the top, right, bottom, and left edges of the image, creating nine slices that map to the element’s corners, sides, and optional center.
This property is essential for decorative border artwork. Without slicing, the whole image cannot be reused as a scalable frame. With the right slice values, corners stay crisp while edge sections repeat or stretch along each side.
💡
Beginner Tip
Think of slicing like cutting a picture frame out of one image: corners come from the four corners of the artwork, and the middle strips become the top, right, bottom, and left borders.
One value applies the same inset from all four sides of the source image.
Two values set vertical insets first, then horizontal insets.
Three values set top, horizontal sides, then bottom.
Four values follow top, right, bottom, left order.
The optional fill keyword keeps the center slice visible inside the element.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Initial value
100%
Applies to
Border image source division
Inherited
No
Animatable
No
Common use
Frame artwork, decorative image borders
Defaults
Default Value
The default value of border-image-slice is 100%. That means the inset lines sit at the outer edges of the image, so the full image is used without cutting inward from the sides.
Reference
💎 Property Values
Value
Example
Meaning
Number
border-image-slice: 30;
Inset distance from each image edge in image coordinates
Percentage
border-image-slice: 25%;
Inset relative to the source image width and height
fill
border-image-slice: 30 fill;
Preserves the center slice as the element background
Multiple values
border-image-slice: 20 40;
Different insets per side using shorthand order
Common Value Types
25%percentage inset
12number inset
20 fillcenter preserved
Compare
border-image-slice vs related properties
Property
Targets
Best for
border-image-slice
How the source image is divided
Cutting frame corners and edges from artwork
border-image-source
Which image or gradient to use
Choosing the border artwork
border-image-repeat
How edge slices are tiled or stretched
Controlling edge appearance after slicing
border-image
Full border image shorthand
Setting slice, source, width, outset, and repeat together
Preview
👀 Live Preview
A box with a border image sliced at 25% from each edge:
Content inside the box
Uses border-image-source: url("/images/apple.png"); and border-image-slice: 25%;.
Hands-On
Examples Gallery
Try border-image-slice with percentages, numbers, the fill keyword, and per-side values.
📚 Basic Slice Values
Divide the source image evenly or with fixed inset distances.
Example 1 — 25% Slice on All Sides
Slice the border image so each edge region uses 25% of the source image, as in the reference tutorial.
border-image-slice-percent.html
<style>.box{width:300px;height:200px;border:10px solid transparent;border-image-source:url("border-image.png");border-image-slice:25%;}</style><divclass="box">
Content inside the box
</div>
Each inset line is placed 25% inward from the image edge. The four corner squares become corner borders, and the edge strips map to the top, right, bottom, and left sides.
Example 2 — Numeric Slice Value
Use a unitless number to inset slice lines by a fixed distance in the source image coordinate system.
In the shorthand url(...) 30, the number 30 is the slice value. It cuts 30 units inward from each edge of the source image.
🎨 fill and Per-Side Slices
Preserve the center region or use different insets on each side.
Example 3 — Slice with fill Keyword
Compare the same slice with and without fill. Without it, the center slice is discarded and the element background shows through. With fill, the center region is painted inside the border.
border-image-slice-fill.css
.box{border:10px solid transparent;border-image-source:linear-gradient(to bottom, #2563eb 30%, #fef08a 30% 70%, #7c3aed 70%);border-image-slice:25%;background:#fff;}/* keep the center slice visible */.box.with-fill{border-image-slice:25% fill;}
The source gradient has a yellow middle band. Slicing at 25% cuts that band as the center region. Without fill, it is thrown away and you see the white background. With fill, the yellow center slice is painted inside the border.
Example 4 — Different Slice on Each Side
Use four values to control top, right, bottom, and left insets separately.
The values 10 20 10 20 inset the top and bottom by 10 and the left and right by 20 in the source coordinate system, creating asymmetric corner and edge regions.
🧠 How border-image-slice Works
1
You provide a source image
Set border-image-source to an image URL or gradient.
Source
2
Slice insets divide the image
border-image-slice cuts the image into nine regions.
Slice
3
Regions map to the border
Corners and edges are placed on the matching sides of the element border box.
Mapping
=
✂️
Image-based frame border
Your element gets a decorative border built from sliced image regions.
Compatibility
Modern Browser Support
The border-image-slice property is supported in all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera.
✓ Baseline · Modern browsers
Border image slicing in today’s browsers
Chrome, Edge, Firefox, Safari, and Opera support border-image-slice including the fill keyword.
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-slice property96% supported
Bottom line: Use border-image-slice for image frame borders in modern projects. Test slice values with your actual artwork dimensions.
Wrap Up
Conclusion
The border-image-slice property is the key to turning one image into a reusable border frame. By choosing the right inset values and optionally using fill, you can create unique decorative borders that go far beyond simple lines.
Experiment with percentages, numbers, and per-side values to see how slicing changes the look of your border artwork on different element sizes.
Design border artwork with clear corner and edge regions
Start with equal percentage slices like 25% for symmetric frames
Use fill when the center art should show inside the box
Test slice values at different element sizes
Combine with border-image-repeat: round for tiled edges
❌ Don’t
Assume unitless numbers are CSS pixels on the element
Use slice values larger than half the image width or height on opposite sides
Forget to set border-image-source and a visible border width
Expect slice to work without a raster or gradient source
Use tiny slice values on high-resolution artwork without testing
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about border-image-slice
Use these points when dividing border image artwork.
5
Core concepts
✂️01
Nine Slices
Divides the image.
Purpose
⚡02
Default 100%
Full image used.
Default
📏03
% or Number
Inset distances.
Values
🖼️04
fill
Keep center art.
Keyword
🛠05
Needs source
Part of border-image.
Usage
❓ Frequently Asked Questions
The border-image-slice property divides a border image into nine regions — four corners, four edges, and a center — by specifying inset distances from each side of the source image.
The initial value is 100%, which uses the entire image without inset slicing from the edges.
The fill keyword keeps the center slice visible and uses it as the element background area inside the border.
Unitless numbers are coordinates measured from the source image edges in the image's own coordinate system, not the element's CSS pixel size.
Yes. You can use one to four values in top, right, bottom, left order, or percentages relative to the image width and height.