--- title: box-decoration-break slug: Web/CSS/box-decoration-break tags: - CSS - CSS Fragmentation - CSS Property - Experimental translation_of: Web/CSS/box-decoration-break ---
{{CSSRef}}{{SeeCompatTable}}
The box-decoration-break
CSS property specifies how the {{ Cssxref("background") }}, {{ Cssxref("padding") }}, {{ Cssxref("border") }}, {{ Cssxref("border-image") }}, {{ Cssxref("box-shadow") }}, {{ Cssxref("margin") }} and {{ Cssxref("clip") }} of an element is applied when the box for the element is fragmented. Fragmentation occurs when an inline box wraps onto multiple lines, or when a block spans more than one column inside a column layout container, or spans a page break when printed. Each piece of the rendering for the element is called a fragment.
{{cssinfo}}
box-decoration-break: slice; box-decoration-break: clone; box-decoration-break: initial; box-decoration-break: inherit; box-decoration-break: unset;
slice
clone
no-repeat
may be repeated multiple times.{{csssyntax}}
An inline element that contains line-breaks styled with:
.example { background: linear-gradient(to bottom right, yellow, green); box-shadow: 8px 8px 10px 0px deeppink, -5px -5px 5px 0px blue, 5px 5px 15px 0px yellow; padding: 0em 1em; border-radius: 16px; border-style: solid; margin-left: 10px; font: 24px sans-serif; line-height: 2; } ... <span class="example">The<br>quick<br>orange fox</span>
Results in:
Adding box-decoration-break:clone
to the above styles:
-webkit-box-decoration-break: clone; -o-box-decoration-break: clone; box-decoration-break: clone;
Results in:
You can try the two inline examples above in your browser.
Here's an example of an inline element using a large border-radius
value. The second "iM"
has a line-break between the "i"
and the "M"
. For comparison, the first "iM"
is without line-breaks. Note that if you stack the rendering of the two fragments horizontally next to each other it will result in the non-fragmented rendering.
Try the above example in your browser.
A block element with similar styles as above, first without any fragmentation:
Fragmenting the above block into three columns results in:
Note that stacking these pieces vertically will result in the non-fragmented rendering.
Now the same example styled with box-decoration-break:clone
Note here that each fragment has an identical replicated border, box-shadow and background.
You can try the block examples above in your browser.
Specification | Status | Comment |
---|---|---|
{{ SpecName('CSS3 Fragmentation', '#break-decoration', 'box-decoration-break') }} | {{ Spec2('CSS3 Fragmentation') }} | Initial definition |
{{ CompatibilityTable() }}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Support on inline elements | {{ CompatVersionUnknown() }}{{property_prefix("-webkit")}} | {{CompatGeckoDesktop(32.0)}} [1] | {{ CompatUnknown() }} | {{ CompatVersionUnknown() }}{{property_prefix("-o")}} | {{ CompatUnknown() }} |
Support on non-inline element | {{CompatNo}} | {{CompatGeckoDesktop(32.0)}} [1] | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{CompatNo}} |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Support on inline elements | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatGeckoMobile("32.0")}} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} |
Support on non-inline element | {{CompatNo}} | {{CompatNo}} | {{ CompatGeckoMobile("32.0")}} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{CompatNo}} |
[1] Note that Firefox implemented an non-standard version of this property before Firefox 32 named {{ Cssxref("-moz-background-inline-policy") }}. That property is unsupported since Firefox 32.