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

The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.

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

句法

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

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

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 ,和 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.

形式定义

初始值 slice
适用于 所有元素
继承 no
计算值 如指定
动画类型 discrete

形式句法

slice | clone
					

范例

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:

A screenshot of the rendering of an inline element styled with box-decoration-break:slice and styles given in the example.

Adding box-decoration-break: clone to the above styles:

-webkit-box-decoration-break: clone;
box-decoration-break: clone;
					

... results in:

A screenshot of the rendering of an inline element styled with box-decoration-break:clone and styles given in the example

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

A screenshot of the rendering of the second inline element example.

Try the above example in your browser.

Block box fragments

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

A screenshot of the rendering of the block element used in the examples without any fragmentation.

Fragmenting the above block into three columns results in:

A screenshot of the rendering of the fragmented block used in the examples styled with box-decoration-break:slice.

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:

A screenshot of the rendering of the fragmented block used in the examples 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.

规范

规范 状态 注释
CSS Fragmentation Module Level 3
The definition of 'box-decoration-break' in that specification.
候选推荐 初始定义。

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
box-decoration-break Chrome 完整支持 22 Prefixed 注意事项
完整支持 22 Prefixed 注意事项
Prefixed Implemented with the vendor prefix: -webkit-
注意事项 This property is only supported for inline elements.
Edge 完整支持 79 Prefixed 注意事项
完整支持 79 Prefixed 注意事项
Prefixed Implemented with the vendor prefix: -webkit-
注意事项 This property is only supported for inline elements.
Firefox 完整支持 32
完整支持 32
不支持 1 — 32 Alternate Name
Alternate Name Uses the non-standard name: -moz-background-inline-policy
IE 不支持 No Opera 完整支持 15 Prefixed
完整支持 Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
不支持 11.5 — 15
Safari 完整支持 6.1 Prefixed 注意事项
完整支持 6.1 Prefixed 注意事项
Prefixed Implemented with the vendor prefix: -webkit-
注意事项 This property is only supported for inline elements.
WebView Android 完整支持 ≤37 Prefixed 注意事项
完整支持 ≤37 Prefixed 注意事项
Prefixed Implemented with the vendor prefix: -webkit-
注意事项 This property is only supported for inline elements.
Chrome Android 完整支持 18 Prefixed 注意事项
完整支持 18 Prefixed 注意事项
Prefixed Implemented with the vendor prefix: -webkit-
注意事项 This property is only supported for inline elements.
Firefox Android 完整支持 32
完整支持 32
不支持 4 — 32 Alternate Name
Alternate Name Uses the non-standard name: -moz-background-inline-policy
Opera Android 完整支持 14 Prefixed
完整支持 Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
不支持 11.5 — 14
Safari iOS 完整支持 7 Prefixed 注意事项
完整支持 7 Prefixed 注意事项
Prefixed Implemented with the vendor prefix: -webkit-
注意事项 This property is only supported for inline elements.
Samsung Internet Android 完整支持 1.0 Prefixed 注意事项
完整支持 1.0 Prefixed 注意事项
Prefixed Implemented with the vendor prefix: -webkit-
注意事项 This property is only supported for inline elements.

图例

完整支持

完整支持

不支持

不支持

见实现注意事项。

见实现注意事项。

使用非标名称。

使用非标名称。

要求使用供应商前缀或不同名称。

要求使用供应商前缀或不同名称。

另请参阅

元数据

  • 最后修改:
  1. CSS
  2. CSS 参考
  3. CSS Fragmentation
  4. 特性
    1. box-decoration-break
    2. break-after
    3. break-before
    4. break-inside
    5. orphans
    6. widows

Copyright  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1