From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/css/mask-border-slice/index.html | 126 +++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 files/zh-cn/web/css/mask-border-slice/index.html (limited to 'files/zh-cn/web/css/mask-border-slice') diff --git a/files/zh-cn/web/css/mask-border-slice/index.html b/files/zh-cn/web/css/mask-border-slice/index.html new file mode 100644 index 0000000000..f183bc1787 --- /dev/null +++ b/files/zh-cn/web/css/mask-border-slice/index.html @@ -0,0 +1,126 @@ +--- +title: mask-border-slice +slug: Web/CSS/mask-border-slice +translation_of: Web/CSS/mask-border-slice +--- +
{{CSSRef}}
+ +

CSS属性除以{{cssxref("掩模边界源")}}成区域的图像集合。这些区域用于形成元素的遮罩边框的组成部分。mask-border-slice

+ +

句法

+ +
/* 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属性可使用一至四个指定<number-percentage>值来表示每个图像切片的位置。负值无效;大于其相应尺寸的值被钳制为100%

+ + + +

fill如果使用了可选值,则可以将其放置在声明中的任何位置。

+ +

价值观

+ +
+
{{cssxref("<number>")}}
+
表示光栅图像的边缘偏移量(像素)和矢量图像的坐标。对于矢量图像,数字是相对于元素的大小,而不是源图像的大小,因此在这些情况下,通常最好使用百分比。
+
{{cssxref("<percentage>")}}
+
将边缘偏移量表示为源图像尺寸的百分比:水平偏移量的图像宽度,垂直偏移量的高度。
+
fill
+
保留中间图像区域。其宽度和高度的大小分别匹配顶部和左侧图像区域。
+
+ +

描述

+ +

切片过程总共创建了九个区域:四个角,四个边缘和一个中间区域。四个切片线,从其各自的侧面设置了给定的距离,以控制区域的大小。

+ +

由border-image或border-image-slice属性定义的九个区域

+ +

上图说明了每个区域的位置。

+ + + +

{{cssxref("mask-border-repeat")}},{{cssxref("mask-border-width")}}和{{cssxref("mask-border-outset")}}属性决定了这些区域用于形成最终的蒙版边框。

+ +

正式定义

+ +

{{cssinfo}}

+ +

形式语法

+ +
{{csssyntax}}
+ +

例子

+ +

基本用法

+ +

该属性似乎在任何地方都不受支持。最终开始受支持时,它将用于定义从源图像获取的切片的大小,并用于创建边框蒙版。

+ +
mask-border-slice: 30 fill;
+ +

基于Chromium的浏览器支持此属性的过时版本mask-box-image-slice-带前缀:

+ +
-webkit-mask-box-image-slice: 30 fill;
+ +
+

注意:该mask-border页面提供了一个有效的示例(使用Chromium支持的过期前缀边框蒙版属性),因此您可以大致了解效果。

+
+ +
+

注意:如果希望元素的内容可见,则必须包含fill关键字。

+
+ +

技术指标

+ + + + + + + + + + + + + + + + +
规范状态评论
{{SpecName("CSS Masks","#propdef-mask-border-slice","mask-border-slice")}}}{{Spec2("CSS Masks")}}初始定义
+ +

浏览器兼容性

+ +

待定

+ +

也可以看看

+ + -- cgit v1.2.3-54-g00ecf