CSS mask-type Property
Example
Look at two SVG <mask> elements; one with mask-type alpha and one with mask-type luminance:
<svg width="200" height="120" xmlns="http://www.w3.org/2000/svg">
<defs>
<mask id="mask1" maskContentUnits="objectBoundingBox"
style="mask-type:alpha">
<rect width="10"
height="10" fill="red" fill-opacity="0.7" />
</mask>
<mask id="mask2" maskContentUnits="objectBoundingBox" style="mask-type:luminance">
<rect width="10" height="10" fill="red" fill-opacity="0.7" />
</mask>
</defs>
</svg>
Try it Yourself »
Definition and Usage
The mask-type property specifies whether an SVG <mask> element
is treated as a luminance mask or as an alpha mask.
This applies to the SVG <mask> element itself.
| Default value: | luminance |
|---|---|
| Inherited: | no |
| Animatable: | no. Read about animatable |
| Version: | CSS Masking Module Level 1 |
| JavaScript syntax: | object.style.maskType="alpha" |
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
| Property | |||||
|---|---|---|---|---|---|
| mask-type | 24 | 79 | 35 | 7 | 15 |
CSS Syntax
mask-type: luminance|alpha|initial|inherit;
Property Values
| Value | Description |
|---|---|
| luminance | Treat the mask image as a luminance mask. This is default. |
| alpha | Treat the mask image as an alpha mask |
| initial | Sets this property to its default value. Read about initial |
| inherit | Inherits this property from its parent element. Read about inherit |
Related Pages
CSS reference: mask property
CSS reference: mask-clip property
CSS reference: mask-composite property
CSS reference: mask-image property
CSS reference: mask-mode property
CSS reference: mask-origin property
CSS reference: mask-position property
CSS reference: mask-repeat property
CSS reference: mask-size property
CSS tutorial: CSS Masking