CSS border-image-width Property
The border-image-width property in CSS specifies the width of the border image. It determines how much space the border image will take up around an element.
1. Syntax
✅ Can be set using different units:
-
Absolute units (px, em, rem, etc.)
-
Percentage (%)
-
Number (relative to border-image-slice)
-
Auto (default width based on image size)
2. Accepted Values
| Value | Description | Example |
|---|---|---|
length | Specifies a fixed width in px, em, etc. | 10px, 2em |
% | Relative to the original border image size | 50% |
number | Relative to border-image-slice value | 1, 2, 3 |
auto | Automatically adjusts to the border image size | auto |
3. Example – Fixed Border Image Width
✅ The border image width is set to 10px.
4. Example – Using Percentage
✅ The border image width will be 50% of the border-image area.
5. Example – Using Auto
✅ The border image width adjusts automatically based on the image size.
6. Example – Different Widths for Each Side
You can specify different widths for each side:
✅ Order of values (clockwise):
-
Top →
10px -
Right →
20px -
Bottom →
30px -
Left →
40px
7. Using border-image Shorthand
Instead of writing separate properties, use the border-image shorthand:
✅ This is equivalent to:
8. Best Practices
✔ Use border-image-width: auto; when unsure about the exact width.
✔ Use percentages (%) for responsive designs.
✔ Ensure border-image-slice is properly set, or border-image-width won’t work correctly.

