CSS mask-border-mode Property
Description
The mask-border-mode property controls how the image used as a border mask is interpreted and applied to an element’s border area. In practice it determines the interpretation of the mask image’s pixel data (for example whether alpha channels or luminance are used) and the compositing approach used when that border-specific mask is combined with other masks or with the element’s own painting. Because it targets the border region, it only affects the pixels that result from the border-image / mask-border slicing and tiling operations, not the element’s interior content directly.
The property is used together with the broader border-masking shorthand and related border mask subproperties — for specifying the mask source, slice, repeat and widths — such as mask-border. It also interacts with properties that control how multiple masks are blended together; for example, the rules that determine whether the border mask adds to, subtracts from, or intersects the element’s main mask rely on compositing semantics similar to those governed by mask-composite. Finally, the element-level mask set by mask and any border mask are combined in a specified order, so the choice of mask-border-mode can change whether the border region remains visible, becomes partially transparent, or is removed entirely when all masks are applied.
In practical use, mask-border-mode is important when the mask image’s channel data could be interpreted in multiple ways (for instance a PNG with an alpha channel versus a grayscale image intended as a luminance mask) or when you need precise control over how the border’s visual mask blends with other masks and the element’s background. Designers use it to get crisp edges on decorative frames, to preserve alpha-based antialiasing, or to achieve soft transitions at the border independent of the interior mask. Because such blending and per-pixel interpretation can affect both visual fidelity and rendering cost, it’s also a consideration for performance when you use complex or multiple masks on high-resolution elements.
Definition
- Initial value
- alpha
- 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.maskBorderMode
Syntax
mask-border-mode: alpha | luminance
Values
- alphaThe default value. It uses the alpha channel (transparency) of the border image to create the mask. Opaque areas remain visible, and transparent areas are hidden.
- luminanceUses the brightness (RGB values) of the border image to create the mask. White or light areas remain visible, while black or dark areas become transparent.
Example
Browser Support
The following information will show you the current browser support for the CSS mask-border-mode property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is not supported by modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
