CSS mask-clip Property
Description
The mask-clip property controls which box of an element — the area used for painting and sizing the mask image(s) — is used to clip the mask. In practice this means it selects the rectangle (for example, the content box, padding box, or border box) against which mask images are aligned and beyond which mask pixels are ignored. Because it changes only how the masking layer is applied and not the element’s layout, it determines which part of the element becomes transparent or opaque without changing box model dimensions or reflow.
When you create a mask with a mask-image, that image is positioned and possibly scaled relative to a reference box; mask-clip chooses which of the element’s boxes serves as that clipping frame. It works together with properties that control where the mask is placed and how it is sized, such as mask-origin, and creates effects analogous to what background-clip does for background painting. If you need a hard geometric clip instead of an alpha mask, consider the alternative approach using clip-path, which defines a vector clipping region rather than an image-based mask.
In practical use, mask-clip is important when you combine masks with borders, padding, or multiple mask layers: changing the reference box can move or crop mask artwork relative to visible content, which affects how gradients or images used as masks reveal the element. It’s commonly used to ensure a mask aligns to an element’s inner content area (so borders aren’t affected) or to make a mask cover the full border area for different visual effects. Because the property is about painting, it’s a powerful way to create non-rectangular visuals or soft transitions without altering DOM structure or layout.
Performance and maintainability tips: prefer simple mask images and avoid very large raster masks that must be repeatedly composited, and be explicit about which box you want to avoid accidental cropping when elements have varying border or padding sizes. Also keep in mind that mask stacking and compositing (when multiple mask layers are used) will interact with the chosen clip region for each layer, so designing masks with a consistent reference box makes results more predictable.
Definition
- Initial value
- border-box
- 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.maskClip
Syntax
mask-clip: <box> | text | no-clip;
Values
- <box>
border-boxThe mask is clipped to the border box of the element, meaning it includes the content, padding, and border area.padding-boxThe mask is clipped to the padding box, excluding the border but including the padding and content.content-boxThe mask is clipped to the content box, excluding padding and border.fill-box(for SVG elements) The mask is clipped to the element’s fill area.stroke-box(for SVG elements) The mask is clipped to the element’s stroke area.view-box(for SVG elements) The mask is clipped to the entire SVG viewport.
- textThe mask is applied only to the text content of the element. This is typically used with
-webkit-prefix in WebKit browsers for text masking. - no-clipThe mask is not clipped, meaning it can extend beyond the element’s box.
Example
Browser Support
The following information will show you the current browser support for the CSS mask-clip 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
