CSS mask-composite Property
Description
The mask-composite property controls how multiple mask layers are combined to form the final transparency map that is applied to an element. When you supply more than one mask (for example via the shorthand mask), each layer contributes an alpha map; mask-composite defines the compositing operation used to merge the alpha values of the top layer with the accumulated result of the layers beneath it. Conceptually, think of each mask layer as a grayscale image that is merged per-pixel with prior layers to produce a single mask that ultimately gates the element’s painting.
At the pixel level, the property operates on alpha information rather than color: it decides how opacity values combine (for example whether areas from a new mask add to, remove from, or intersect with existing opaque regions). The compositing is carried out in the mask space before that mask is applied to the element’s rendering, and it is applied consistently across mask images, gradients, and SVG masks (for mask sources such as mask-image). Because the operations work on the mask’s transparency, color channels of mask images are disregarded unless the mask mode forces them into use; the end result is a single alpha map used to clip or reveal the underlying painting.
In practice, mask-composite is often used in combination with layered masks and other clipping or blending techniques to create complex reveals, cutouts, or boolean-like masking effects. It interacts conceptually with clipping mechanisms (for example clip-path) and with compositing/blending at the painting level (for example mix-blend-mode), but it only governs how the mask layers themselves merge — it does not change the geometric layout of the element. Because mask compositing can require intermediate rasterization and offscreen compositing, it can have performance implications (especially when animated), and the visual/interactive behavior of masked areas (hit-testing, accessibility affordances) can vary by user agent, since masking affects painting rather than layout geometry.
Definition
- Initial value
- add
- Applies to
- all elements; In SVG, it applies to container elements excluding the <defs> element and all graphics elements
- Inherited
- no
- Computed value
- as specified
- Animatable
- yes
- JavaScript syntax
- object.style.maskComposite
Syntax
mask-composite: <value>;
Values
- <value>
- add – The mask layers are combined in a way that shows the union of all masks.
- subtract – The top mask subtracts from the bottom mask, making the overlapped area transparent.
- intersect – Only the intersection of mask layers is visible; areas outside the overlap are hidden.
- exclude – The areas where mask layers overlap are excluded (made transparent), while the non-overlapping areas are visible.
- replace – Only the topmost mask layer is applied, completely replacing any lower masks.
- inherit – The element inherits the
mask-compositevalue from its parent. - initial – Sets the property to its default value (which is usually
add). - unset – Resets the property to either its inherited value or initial value if no parent exists.
Example
Browser Support
The following information will show you the current browser support for the CSS mask-composite property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
