The border-image-width property controls how wide the sliced border image is painted on each side of an element.
01
Length
px, em, rem.
02
Percentage
Relative sizing.
03
Number
border-width multiplier.
04
auto
Slice intrinsic size.
05
Four Values
Per-side widths.
06
Longhand
Part of border-image.
Fundamentals
Definition and Usage
The border-image-width CSS property sets the width of the border image area on each side. After a source image is sliced, this property decides how large those slices appear when painted as the element’s border.
It is a longhand of the border-image shorthand and gives you fine control over decorative borders. You can make a frame thicker or thinner independently of the element’s regular border-width, or let the width follow the slice artwork with auto.
💡
Beginner Tip
border-width reserves space in the layout. border-image-width controls how big the image border looks inside that space. They often match, but they do not have to.
Default vs Custom Width
border-image-width: 1
border-image-width: 20px
Foundation
📝 Syntax
border-image-width accepts one to four width values:
The default value of border-image-width is 1. As a unitless number, it acts as a multiplier of the element’s border-width on each side, so the border image width typically matches the reserved border area.
Reference
💎 Property Values
Value
Example
Meaning
Length
border-image-width: 20px;
Fixed width for the border image on each side
Percentage
border-image-width: 50%;
Width relative to the border area size
Number
border-image-width: 2;
Multiplier of the corresponding border-width
auto
border-image-width: auto;
Uses the intrinsic width or height of the image slice
Common Value Types
16pxfixed length
22× border-width
autoslice intrinsic size
Compare
border-image-width vs related properties
Property
Targets
Best for
border-image-width
How wide the border image is painted
Controlling frame thickness of sliced artwork
border-width
Layout border area size
Reserving space in the box model
border-image-outset
How far the border image extends outward
Drawing the border outside the border box
border-image
Full border image shorthand
Setting source, slice, width, outset, and repeat together
Preview
👀 Live Preview
A box with a 20px border image width:
Uses border-image-width: 20px; with a sliced image source.
Hands-On
Examples Gallery
Try border-image-width with lengths, multipliers, auto, and per-side values.
📚 Basic Width Values
Control how thick the border image appears.
Example 1 — Length Value (20px)
Set a fixed 20px border image width, matching the reference tutorial example.
The border image is painted 20px wide on each side. Because this exceeds the 10px border-width, the image border can extend into the padding area while still using the border box as its reference.
Example 2 — Unitless Number Multiplier
Use 2 to make the border image twice as wide as the corresponding border-width.
auto tells the browser to size each side based on the slice dimensions in the source image, which is useful when your artwork has a natural frame thickness.
Example 4 — Different Width on Each Side
Use four values to set top, right, bottom, and left border image widths separately.
The values 6px 16px 6px 16px make the top and bottom image borders thinner than the left and right sides, creating an asymmetric frame effect.
🧠 How border-image-width Works
1
Source and slice are set
The border artwork is chosen and divided into regions.
Setup
2
Width values are applied
border-image-width sets how thick each side’s image border is.
Width
3
Slices are painted
Corner and edge regions are drawn at the specified width on each side.
Paint
=
📏
Sized border image
The frame appears at the width you defined on each edge.
Compatibility
Modern Browser Support
The border-image-width property is supported in all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera.
✓ Baseline · Modern browsers
Border image width in today’s browsers
Length, percentage, number, and auto values all work 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-width property96% supported
Bottom line: Use border-image-width to fine-tune frame thickness in modern projects. Test with your actual border artwork and element sizes.
Wrap Up
Conclusion
The border-image-width property gives you precise control over how thick a border image appears on each side. Whether you use fixed lengths, multipliers, or auto, it helps you match your frame artwork to the design you want.
Combine it with source, slice, and repeat properties to build decorative borders that go beyond standard solid lines.
Start with the default 1 and adjust only when needed
Use auto when your slice artwork has a natural frame thickness
Set a visible border-width alongside border-image properties
Test width values at different element sizes
Use the shorthand / syntax in border-image for width
❌ Don’t
Confuse border-image-width with border-width
Assume a length width always stays inside the border box
Forget border-image-source and border-image-slice
Use extremely large widths without checking layout impact
Mix up border-image-width with border-image-outset
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about border-image-width
Use these points when sizing border images.
5
Core concepts
📏01
Sets thickness
Image border size.
Purpose
⚡02
Default 1
Matches border-width.
Default
📏03
px or %
Fixed or relative.
Values
📈04
Number
Width multiplier.
Multiplier
🛠05
auto
Slice intrinsic size.
Keyword
❓ Frequently Asked Questions
The border-image-width property sets how wide the border image is drawn on each side. It can use lengths, percentages, unitless multipliers of border-width, or auto to match slice dimensions.
The initial value is 1, a unitless number that makes the border image width follow the element's border-width on each side.
border-width reserves space in the box model. border-image-width controls how large the sliced border image is painted within that area and can differ from border-width.
The auto keyword uses the intrinsic width or height of the corresponding border image slice from the source artwork.
Yes. You can use one to four values in top, right, bottom, left order, just like border-width shorthand.