CSS

面具类型 | mask-type

mask-type

mask-type属性定义由SVG定义的掩码。<mask>元素用作亮度或者阿尔法 mask。适用于<mask>元素。它可能被掩码模式属性,该属性具有相同的效果,但适用于使用掩码的元素。阿尔法mask 通常会更快地渲染。

/* Keyword values */ mask-type: luminance; mask-type: alpha; /* Global values */ mask-type: inherit; mask-type: initial; mask-type: unset;

Initial valueluminance
Applies to<mask> elements
Inheritedno
Mediavisual
Computed valueas specified
Animation typediscrete
Canonical orderthe unique non-ambiguous order defined by the formal grammar

语法

下面列出的一个或多个关键字值,以逗号分隔。

luminance是一个关键字,指示关联的掩码图像是亮度掩码,即它的相对亮度应用时必须使用值。

形式语法

luminance | alpha

实例

让%27将以下矩形应用于掩码:

<rect x="10" y="10" width="80" height="80" fill="red" fill-opacity="0.7" />

呈现如以下代码块:

在这个盒子里:

如果浏览器支持该属性,则结果具有不同的mask-type应用于<mask>元素是这两个不同的正方形:

mask-type: alpha;mask-type: luminance;

规格

SpecificationStatusComment
CSS Masking Module Level 1The definition of 'mask-type' in that specification.Candidate RecommendationInitial definition.

浏览器兼容性

FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support (for SVG)24.035.0 (35.0)1No support15.07
Applies to HTML elementsNo support35.0 (35.0)1No supportNo support?

FeatureAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support (for SVG)?35.0 (35.0)1No support15.0No support
Applies to HTML elements?????