mask-border-slice
CSS
property divides the image set by
mask-border-source
into regions. These regions are used to form the components of an element's
mask border
.
/* All sides */ mask-border-slice: 30%; /* vertical | horizontal */ mask-border-slice: 10% 30%; /* top | horizontal | bottom */ mask-border-slice: 30 30% 45; /* top | right | bottom | left */ mask-border-slice: 7 12 14 5; /* Using the `fill` keyword */ mask-border-slice: 10% fill 7 12; /* Global values */ mask-border-slice: inherit; mask-border-slice: initial; mask-border-slice: unset;
mask-border-slice
property may be specified using one to four
<number-percentage>
values to represent the position of each image slice. Negative values are invalid; values greater than their corresponding dimension are clamped to
100%
.
可选
fill
value, if used, can be placed anywhere in the declaration.
<number>
<percentage>
Represents an edge offset as a percentage of the source image's size: the width of the image for horizontal offsets, the height for vertical offsets.
fill
Preserves the middle image region. Its width and height are sized to match the top and left image regions, respectively.
The slicing process creates nine regions in total: four corners, four edges, and a middle region. Four slice lines, set a given distance from their respective sides, control the size of the regions.
The above diagram illustrates the location of each region.
fill
有设置。
mask-border-repeat
,
mask-border-width
,和
mask-border-outset
properties determine how these regions are used to form the final mask border.
| 初始值 |
0
|
|---|---|
| 适用于 |
all elements; In SVG, it applies to container elements excluding the
defs
element and all graphics elements
|
| 继承 | no |
| 百分比 | refer to size of the mask border image |
| 计算值 | 如指定 |
| 动画类型 | discrete |
<number-percentage>{1,4} fill?where
<number-percentage> = <number> | <percentage>
This property doesn't appear to be supported anywhere yet. When it eventually starts to be supported, it will serve to define the size of the slices taken from the source image, and used to create the border mask.
mask-border-slice: 30 fill;
Chromium-based browsers support an outdated version of this property —
mask-box-image-slice
— with a prefix:
-webkit-mask-box-image-slice: 30 fill;
注意
: The
mask-border
page features a working example (using the out-of-date prefixed border mask properties supported in Chromium), so you can get an idea of the effect.
注意 : The fill keyword needs to be included if you want the element's content to be visible.
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Masking Module Level 1
The definition of 'mask-border-slice' in that specification. |
候选推荐 | Initial defintion |
TBD