この翻訳は不完全です。英語から この記事を翻訳 してください。
これは実験段階の機能です。
この機能は複数のブラウザで開発中の状態にあります。各ブラウザで用いるために、適切なベンダー接頭辞が必要な場合があります。互換性テーブルをチェックしてください。また、実験段階の機能の構文と挙動は、仕様変更に伴い各ブラウザの将来のバージョンで変更になる可能性があることに注意してください。
Summary
The box-decoration-break
CSS property specifies how the background
, padding
, border
, border-image
, box-shadow
, margin
and 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.
初期値 | slice |
---|---|
適用対象 | 全要素 |
継承 | 不可 |
メディア | visual |
計算値 | 指定値 |
アニメーションの可否 | 不可 |
正規順序 | 形式文法で定義される一意のあいまいでない順序 |
Syntax
box-decoration-break: slice; box-decoration-break: clone; box-decoration-break: initial; box-decoration-break: inherit; box-decoration-break: unset;
Values
slice
- The element is rendered as if its box were not fragmented, and then 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-shadow
, are applied to each fragment independently. The background is drawn independently in each fragment which means that a background image withbackground-repeat
:no-repeat
may be repeated multiple times.
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; -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.
Block box fragments
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.
Specifications
Specification | Status | Comment |
---|---|---|
CSS Fragmentation Module Level 3 The definition of 'box-decoration-break' in that specification. |
草案 | Initial definition |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Support on inline elements | (有)-webkit | 32.0 (32.0) [1] | ? | (有)-o | ? |
Support on non-inline element | 未サポート | 32.0 (32.0) [1] | ? | ? | 未サポート |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Support on inline elements | ? | ? | 32.0 (32.0) | ? | ? | ? |
Support on non-inline element | 未サポート | 未サポート | 32.0 (32.0) | ? | ? | 未サポート |
[1] Note that Firefox implemented an non-standard version of this property before Firefox 32 named -moz-background-inline-policy
. That property is unsupported since Firefox 32.