π Introduction
The border-image-outset property controls how far the border image extendsoutside the elementβs border box. While border-image-width sets the thickness *inside* the border area,border-image-outset determines how much extra area the border image can push outward. This property is essential for creating decorative borders that sit outside the element, giving designs a more dramatic or artistic effect. π¨β¨
π― What Does border-image-outset Do?
- Moves border images outward from the elementβs border box π€
- Prevents clipping of large or intricate border images
- Allows per-side control of outward expansion
- Works together with all other
border-image-*properties
β¨ Syntax
CSS Syntax
selector {
border-image-outset: <number> | <length> | <number>{1,4};
}Note
π§© Accepted Values
1. Number (unitless)
Multiplies the border-width. If border-width: 10px and border-image-outset: 2; β border image expands outward by 20px.
Number Example
.box {
border-width: 10px;
border-image-outset: 2; /* expands 20px outward */
}2. Length (px, rem, etc.)
Sets a fixed outward expansion.
Length Example
border-image-outset: 15px;3. Four Values (TRBL)
Control expansion per side: top β right β bottom β left.
Per-Side Outset
/* top | right | bottom | left */
border-image-outset: 5px 10px 15px 20px;π§© How border-image-outset Interacts with Other Border Image Properties
| Property | What It Controls |
|---|---|
| border-image-source | Image or gradient used as border |
| border-image-slice | How the image is cut into pieces |
| border-image-width | Thickness of the border image |
| border-image-outset | How far outside the border the image expands |
| border-image-repeat | How slices are repeated: stretch, repeat, or round |
π₯ Practical Examples
1. Basic Outward Expansion
Basic Outset
.frame {
border: 20px solid transparent;
border-image-source: url("frame.png");
border-image-slice: 30;
border-image-outset: 10px;
}2. Decorative Border Pushed Outside
Decorative Outset
.decor {
border: 15px solid transparent;
border-image-source: url("ornament.png");
border-image-slice: 25;
border-image-width: 20px;
border-image-outset: 5px;
}3. Per-Side Outset for Artistic Effect
Asymmetric Outset
.asymmetric {
border: 20px solid transparent;
border-image-source: url("art.png");
border-image-slice: 20;
border-image-outset: 0 10px 20px 30px;
}4. Using Unitless Multipliers
Multiplier Outset
.scaled {
border-width: 12px;
border-image-source: url("texture.png");
border-image-slice: 30;
border-image-outset: 2 1 0.5 3; /* TRBL multipliers */
}5. Combine With border-image-repeat
Repeated Pattern Border
.pattern {
border: 18px solid transparent;
border-image-source: url("pattern.png");
border-image-slice: 20;
border-image-repeat: repeat;
border-image-outset: 10px;
}π Value Behavior Summary
| Value Type | Effect |
|---|---|
| Number | Multiplies border-width for outward expansion |
| Length | Exact outward push |
| 4 values | Control each side individually |
πΌοΈ Visual Demo
Further details can be found at: https://dummyimage.com/900x260/eeeeee/000000&text=border-image-outset+demo
π Conclusion
The border-image-outset property is essential when your border image needs extra breathing room outside the element. It prevents clipping and allows artistic borders to extend as far as you need. Combine it with border-image-width, border-image-slice,border-image-source, and border-image-repeat for complete control over border-image design. π