`box-decoration-break` CSS property
Baseline Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
The box-decoration-break CSS property specifies how an element's fragments should be rendered when broken across multiple lines, columns, or pages.
Try it
-webkit-box-decoration-break: slice; box-decoration-break: slice;
-webkit-box-decoration-break: clone; box-decoration-break: clone;
<section id="default-example">
<div id="example-container">
<span id="example-element">This text breaks across multiple lines.</span>
</div>
</section>
#example-container {
width: 14rem;
}
#example-element {
background: linear-gradient(to bottom right, #6f6f6f, black);
color: white;
box-shadow:
8px 8px 10px 0 #ff1492,
-5px -5px 5px 0 blue,
5px 5px 15px 0 yellow;
padding: 0 1em;
border-radius: 16px;
border-style: solid;
margin-left: 10px;
font: 24px sans-serif;
line-height: 2;
}
Syntax
/* Keyword values */ box-decoration-break: slice; box-decoration-break: clone; /* Global values */ box-decoration-break: inherit; box-decoration-break: initial; box-decoration-break: revert; box-decoration-break: revert-layer; box-decoration-break: unset;
Values
This property is specified as one of the following keyword values:
-
slice - The element is initially rendered as if its box were not fragmented, after which the rendering for this hypothetical box is sliced into pieces for each line/column/page. Note that the hypothetical box can be different for each fragment since it uses its own height if the break occurs in the inline direction, and its own width if the break occurs in the block direction. See the CSS specification for details.
-
clone - Each box fragment is rendered independently with the specified border, padding, and margin wrapping each fragment. The
border-radius,border-image, andbox-shadoware applied to each fragment independently. The background is also drawn independently for each fragment, which means that a background image withbackground-repeat: no-repeatmay nevertheless repeat multiple times.
Description
The specified value will impact the appearance of the following properties:
Formal definition
| Initial value | slice |
|---|---|
| Applies to | all elements |
| Inherited | no |
| Computed value | as specified |
| Animation type | discrete |
Formal syntax
box-decoration-break =
slice |
clone
Examples
Inline box fragments
An inline element with a box decoration may have unexpected appearance when it contains line breaks due to the initial slice value. The following example shows the effect of adding box-decoration-break: clone to a <span> that contains <br> tags:
body {
display: flex;
background-color: grey;
justify-content: space-around;
}
span {
padding: 0em 1em;
border-radius: 1rem;
border-style: solid;
margin: 1rem;
font: 22px sans-serif;
line-height: 2;
}
span {
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;
}
#clone {
-webkit-box-decoration-break: clone;
box-decoration-break: clone;
}
<p> <span>The<br />quick<br />orange fox</span> </p> <p> <span id="clone">The<br />quick<br />orange fox</span> </p>
Block box fragments
The following example shows how block elements with box decoration look when they contain line breaks in a multi-column layout. Notice how the result of box-decoration-break: slice would be the equivalent of the first <div> if stacked vertically.
body {
background-color: grey;
}
span {
padding: 0em 2em;
border-radius: 250px;
border-style: solid;
margin-left: 1em;
font: 20px sans-serif;
line-height: 1.5;
}
span {
display: block;
background: linear-gradient(to bottom right, yellow, green);
box-shadow:
inset 8px 8px 10px 0px deeppink,
inset -5px -5px 5px 0px blue,
inset 5px 5px 15px 0px yellow;
}
#base {
width: 33%;
}
.columns {
columns: 3;
}
.clone {
-webkit-box-decoration-break: clone;
box-decoration-break: clone;
}
<div id="base"> <span>The<br />quick<br />orange fox</span> </div> <br /> <h2>'box-decoration-break: slice'</h2> <div class="columns"> <span>The<br />quick<br />orange fox</span> </div> <h2>'box-decoration-break: clone'</h2> <div class="columns"> <span class="clone">The<br />quick<br />orange fox</span> </div>
Specifications
| Specification |
|---|
| CSS Fragmentation Module Level 3 # break-decoration |
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on iOS | Samsung Internet | WebView Android | WebView on iOS | |
box-decoration-break |
130
22This property is only supported for inline elements. |
130
79This property is only supported for inline elements. |
32 |
115
15
11.5–15
|
7This property is only supported for inline elements. |
130
25This property is only supported for inline elements. |
32 |
86
14
11.5–14
|
7This property is only supported for inline elements. |
28.0
1.5This property is only supported for inline elements. |
130
4.4This property is only supported for inline elements. |
7This property is only supported for inline elements. |
clone |
130
22–130This value was only supported with the -webkit- prefix. |
130
79–130This value was only supported with the -webkit- prefix. |
32 |
115
15–115This value was only supported with the -webkit- prefix. |
7 |
130
25–130This value was only supported with the -webkit- prefix. |
32 |
86
14–86This value was only supported with the -webkit- prefix. |
7 |
28.0
1.5–28.0This value was only supported with the -webkit- prefix. |
130
4.4–130This value was only supported with the -webkit- prefix. |
7 |
slice |
130
22–130This value was only supported with the -webkit- prefix. |
130
79–130This value was only supported with the -webkit- prefix. |
32 |
115
15–115This value was only supported with the -webkit- prefix. |
7 |
130
25–130This value was only supported with the -webkit- prefix. |
32 |
86
14–86This value was only supported with the -webkit- prefix. |
7 |
28.0
1.5–28.0This value was only supported with the -webkit- prefix. |
130
4.4–130This value was only supported with the -webkit- prefix. |
7 |
See also
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/box-decoration-break