border-image lets you paint borders from an image or gradient source for decorative framing effects.
When to use
- Branded decorative frames.
- Artistic callouts without extra wrappers.
Pitfall
Complex border-image setups can be hard to maintain; use sparingly and document slices/repeats.
Important interview questions and answers
- Q: Why is border-image uncommon?
A: Higher complexity than standard border + pseudo-element approaches. - Q: What does
border-image-slicedo?
A: Defines how source image is divided for corners/edges. - Q: Lightweight alternative?
A: Gradient backgrounds or pseudo-elements for decorative edges.
Practice: Change one property in the playground and observe cascade + layout in DevTools.