The mask-type
CSS property sets whether an SVG <mask>
element is used as a luminance or an alpha mask. It applies to the <mask>
element itself.
/* Keyword values */ mask-type: luminance; mask-type: alpha; /* Global values */ mask-type: inherit; mask-type: initial; mask-type: unset;
This property may be overridden by the mask-mode
property, which has the same effect but applies to the element where the mask is used. Alpha masks will generally be faster to render.
Initial value | luminance |
---|---|
Applies to |
<mask> elements |
Inherited | no |
Media | visual |
Computed value | as specified |
Animation type | discrete |
Canonical order | per grammar |
The mask-type
property is specified as one of the keyword values listed below.
luminance
alpha
luminance | alpha
Let's apply the following rectangle as a mask:
<rect x="10" y="10" width="80" height="80" fill="red" fill-opacity="0.7" />which leads to the following square:
to this box:
The result, if your browser supports the property, with different value of mask-type
applied to the <mask>
element are these two different squares:
mask-type: alpha; | mask-type: luminance; |
Specification | Status | Comment |
---|---|---|
CSS Masking Module Level 1 The definition of 'mask-type' in that specification. | Candidate Recommendation | Initial definition. |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 24 | ? | 35
|
? | ? | ? |
Applies to HTML elements | No | ? | 20 | No | No | ? |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | ? | ? | ? | 35
|
? | ? | ? |
Applies to HTML elements | ? | ? | ? | 20 | ? | ? | No |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/mask-type