box-decoration-break
Quick Summary for box-decoration-break
The box-decoration-break CSS property specifies how an element's fragments should be rendered when broken across multiple lines, columns, or pages.
Code Usage for box-decoration-break
/* Keyword values */ box-decoration-break: slice; box-decoration-break: clone;  /* Global values */ box-decoration-break: initial; box-decoration-break: inherit; box-decoration-break: revert; box-decoration-break: unset; 
More Details for box-decoration-break

box-decoration-break

The box-decoration-break CSS property specifies how an element's fragments should be rendered when broken across multiple lines, columns, or pages.

The specified value will impact the appearance of the following properties:

background border border-image box-shadow clip-path margin padding

Syntax

/* Keyword values */ box-decoration-break: slice; box-decoration-break: clone;  /* Global values */ box-decoration-break: initial; box-decoration-break: inherit; box-decoration-break: revert; box-decoration-break: unset; 

The box-decoration-break property is specified as one of the keyword values listed below.

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, and box-shadow are applied to each fragment independently. The background is also drawn independently for each fragment, which means that a background image with background-repeat: no-repeat may nevertheless repeat multiple times.

Formal definition

Initial valueslice
Applies toall elements
Inheritedno
Computed valueas specified
Animation typediscrete

Formal syntax

slice | clone

Examples

Inline box fragments

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; 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.

Block box fragments

A block element with similar styles as above and no fragmentation results in:

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 but styled with box-decoration-break: clone results in:

Note here that each fragment has an identical replicated border, box-shadow, and background.

You can try the block examples above in your browser.

Specifications

Specification
CSS Fragmentation Module Level 3 # break-decoration

See also

break-after, break-before, break-inside

Last modified: Aug 12, 2021, by MDN contributors

Select your preferred language English (US)Français日本語中文 (简体) Change language

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Categories in CSS
css
Search CSS
Search CSS by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
The mind must be given relaxation; it will arise better and keener after resting. As rich fields must not be forced-for their productiveness, the have no rest, will quickly exhaust them constantlabor will break the vigor of the mind, but if it is released and relaxed a little while, it will recover its powers
Seneca
Random CSS Property

font-variant

The font-variant CSS shorthand property allows you to set all the font variants for the fonts specified in the @font-face rule.
font-variant (@font-face) css reference