Mask-image - CSS Property
Summary of characteristics of the mask-image property
SVG: containers except defs, graphic elements, use.
nonenoneDiscrète: during an animation, the mask-image property passes from one value to another without transition.Per grammar: serialization in the order of syntax.Syntax diagram of mask-image.
mask-image property.The links in the diagram provide more details about the values.
Download the diagram.
In the diagram, the bold terms are the predefined words of CSS, the other terms are described below:
urlis the path and the name of an image file.imageis an image, defined with one of the following functions:url()orsrc(),image(),image-set(),cross-fade(),stripes(),element().gradientis a gradient of colors obtained using one of theconic-gradient(),linear-gradient(),radial-gradient(),repeating-conic-gradient(),repeating-linear-gradient(),repeating-radial-gradient()functions.- Several masks can be defined by repeating the syntaxes separated by commas.
Description of the mask-image property.
Masking is a relatively recent technique, which involves hiding certain parts of an element based on another element, which is most often an image.
The property mask-image sets the mask or masks to use for hiding the element. The mask can be an image, a gradient, or an SVG file.


The mask.

mask-image.
Refer to the short-hand property mask for more details on the masking technique.

Values for mask-image.
- mask-image: none;
No mask is applied to the element, so it’s fully visible.
TEXTNo masking. - mask-image: url('chemin/fichier'); mask-image: image('chemin/fichier');
These two functions define the file path and name of the mask, but there are other functions you can use:
url()orsrc(),image(),image-set(),cross-fade(),stripes(),element(). The mask can be a PNG image or an SVG file.In the case of a separate SVG file, you can specify an ID for the mask. For example:
mask-image:url('path/file.svg#id');
If the SVG code is on the page, you just need to specify the ID.TEXTMasking with a PNG image.TEXTMasking with a SCG image. - mask-image: linear-gradient(...); mask-image: radial-gradient(...); mask-image: conic-gradient(...);
In these syntaxes, the mask is specified by a color gradient, defined by one of the gradient functions.
For more details on the syntax of gradient functions, see the description of these functions or the one that defines a repeating gradient:
conic-gradient(),linear-gradient(),radial-gradient(),repeating-conic-gradient(),repeating-linear-gradient(),repeating-radial-gradient().TEXTMasking with a linear gradient.linear-gradient(black,transparent)TEXTMasking with a radial gradient.radial-gradient(black,transparent) - mask-image: url(...), url(...);
Combination of multiple masks. The different masks are separated by commas. All valid syntaxes for a single mask (image, gradient, SVG file) can be used in this multiple mask syntax. The masks are combined with each other using the
mask-compositeproperty.For more details and examples, refer to the page on multiple masks.
TEXTMasking with a linear gradient and an image.
With a composition of masks of theexcludetype. - mask-image: initial; (
none) mask-image: inherit; mask-image: revert; mask-image: revert-layer; mask-image: revert-rule; mask-image: unset;Common values are presented on these pages:
initial,inherit,revert,revert-layer,revert-rule,unset.
Animation of the mask-image property.
The animation of mask-image can give some nice effects. Some browsers actually apply a fade effect when moving from one mask to another.
Browsers compatibility with mask-image.
Masking techniques and the mask-image property are now well supported by current browsers.
mask-image property that defines the image or gradient that will be used as a mask.Notes:
(1) Requires the -webkit- prefix. Supports the properties mask-image and >mask-box-image but not the other mask-related properties.
(2) Supported with the -webkit- prefix.
as a mask
mask-imageproperty
Browsers on computers :
Mobile browsers :
Outdated or marginal browsers :

Internet Explorer

UC Browser pour Androïd

Opéra Mobile

QQ Browser

Baidu Browser

Samsung Internet

Safari

Safari sur IOS

Chrome

Opéra

Edge

Chrome pour Androïd

Firefox pour Androïd

Firefox

Androïd Brower

KaiOS Browser

Opéra mini
Historic of the mask-image property.
-
CSS Masking Module Level 1
This specification module describes two ways to partially or completely hide portions of visual elements: masking and clipping.
Masking involves using another graphic element or an image as a mask.
Clipping describes the visible region of visual elements. The region can be described using certain SVG graphic elements or simple shapes. Anything outside this region is not rendered.Regardingmask-imageIntroduction of image masking techniques. And first definition of themaskproperty.November 15, 2012Working Draft.August 26, 2014Candidate Recommendation.
See also, about masking techniques.
The specification that covers everything related to masking is called CSS Masking Module.
The property mask-image and the properties below are shown in this module:
Properties:













