Box Decoration Break box-decoration-*
Control how box decorations (background, border, padding) behave when an element breaks across multiple lines, columns, or pages.
Quick Reference
box-decoration-clone
Each fragment is decorated independently
box-decoration-slice
Decoration is sliced across fragments
Interactive Examples
Box Decoration Clone
<span class="box-decoration-clone bg-gradient-to-r from-blue-500 to-purple-500">
Text spanning multiple lines
</span>
Box Decoration Slice (Default)
<span class="box-decoration-slice bg-gradient-to-r from-green-500 to-teal-500">
Text spanning multiple lines
</span>
Border Behavior
Clone (Each fragment bordered)
Slice (Continuous border)
Padding Behavior
Clone (Padding on each fragment)
Slice (Continuous padding)
Side-by-Side Comparison
box-decoration-clone
✓ Each fragment has complete decorations
✓ Rounded corners on all fragments
✓ Full padding on each line
box-decoration-slice
✓ Continuous decoration flow
✓ No duplicate borders
✓ Natural line breaking
Common Use Cases
🏷️ Inline Tags
Create distinct tag-like elements that break across lines.
<span class="box-decoration-clone">
🎨 Highlighted Text
Apply highlighting that flows naturally across line breaks.
<mark class="box-decoration-slice">
📝 Code Spans
Style inline code that may wrap across multiple lines.
<code class="box-decoration-clone">
🔗 Link Styling
Create distinctive link appearances that handle line breaks well.
<a class="box-decoration-slice">
💬 Quote Styling
Style inline quotes with proper decoration handling.
<q class="box-decoration-clone">
⚠️ Inline Alerts
Create inline warning or info text with proper styling.
<span class="box-decoration-clone">
Best Practices
✅ Do
- • Use
box-decoration-clone
for distinct segments - • Use
box-decoration-slice
for continuous highlighting - • Test with varying text lengths and screen sizes
- • Consider readability across line breaks
- • Apply to inline elements that may wrap
- • Use for tag-like styling that needs consistency
❌ Don't
- • Apply to block-level elements unnecessarily
- • Use complex gradients with slice if not needed
- • Ignore the visual impact on readability
- • Forget to test with different content lengths
- • Use when default behavior is sufficient
- • Apply without considering performance impact
Browser Support & Performance
🌐 Browser Support
⚡ Performance Notes
- • Minimal performance impact on modern browsers
- • Clone mode may use slightly more memory
- • Works efficiently with CSS transforms
- • No JavaScript required
- • Optimized for text rendering
- • Compatible with responsive designs
Related Layout Classes
break-inside-*
Control breaks within elements
box-border
Box sizing utilities
box-decoration-*
Current page