CSS Reference Property

mask-border-source n2c2f

The mask-border-source property is used to specify an image that is to be used as a mask border image. 4e6f4z

The mask border image is set to an element using the same steps used to set a border-image-repeat properties.

The mask-border-source property is usually set as part of the shorthand mask-border shorthand property’s entry.

An image that is an empty image (zero width or zero height), that fails to , is non-existent, or that cannot be displayed (e.g. because it is not in a ed image format) is ignored. It still counts as an mask border image but does not mask the element.

The application of the mask-border-source property to an element formatted with the CSS box model establishes a opacity property does, and all the element’s descendants are rendered together as a group with the masking applied to the group as a whole.

The mask-border-source property has no effect on the geometry or hit-testing of any element’s CSS boxes. Which means that it does not affect how the element responds to pointer events.

mask-border-source and the mask-image is applied to the element before or after mask-border-source. Both operation orders result in the same rendering.

Note that the mask-border-repeat.

Official Syntax 55184y

  • Syntax:

    mask-border-source: none | <image>
                           
  • Initial: none
  • Applies To: All elements. In SVG, it applies to container elements excluding the <defs> element and all graphics elements
  • Animatable: no

Values 584j31

none
No mask border image is applied.
<image>
See the image entry for a list of possible values.

Notes z5jo

A computed value of other than none results in the creation of a opacity property does for values other than 1.

Examples 3e5p5z

mask-border-image: url(border-mask.png);
mask-border-image: none;
mask-border-image: linear-gradient(black, transparent); /* a linear gradient is an <image> */
                

Live Demo 2x4j2k

See the mask-border shorthand property entry for a live demo.

Browser k5t66

CSS Masks 1o5wz

Method of displaying part of an element, using a selected image as a mask

W3C Candidate Recommendation

ed from the following versions:

Desktop 3n671n

  • No
  • 53
  • No
  • No
  • No

Mobile / Tablet 4q224p

  • No
  • No
  • No
  • No
  • 60

* denotes prefix required.

  • ed:
  • Yes
  • No
  • Partially
  • Polyfill

Stats from caniuse.com

Notes z5jo

This module, as you can see in the table above, hasn’t been fully implemented in all browsers, so you’re probably not going to be able to use all features even in browsers that have implemented certain properties (for the time being).

In the meantime, you can check out this open source feature table by Alan Greenblatt on GitHub. The purpose of this table is to provide some insight into what the current state of affairs is with various browser implementations of CSS Clipping and Masking features.

Further Reading 4g1p1d

Written by

Last updated June 11, 2020 at 9:26 pm by Mary Lou

Do you have a suggestion, question or want to contribute? Submit an issue.