-webkit-mask-box-image CSS property

Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.

The non-standard prefixed -webkit-mask-box-image shorthand property sets the mask image for an element's border box.

Note: This property is not standard and is not on any standards track. Consider using the mask-border property instead.

Constituent properties

This property is a shorthand for the following CSS properties:

The values includes the <image> to be used as the mask border, and optionally four border outset values and up to two border repeat styles.

Syntax

css
/* default */
-webkit-mask-box-image: none;

/* image */
-webkit-mask-box-image: url("image.png");

/* image edge-offset */
-webkit-mask-box-image: url("image.png") 10 20 20 10;
-webkit-mask-box-image: url("image.png") 10px 20px 20px 10px;

/* image repeat-style */
-webkit-mask-box-image: url("image.png") space repeat;

/* image edge-offset repeat-style */
-webkit-mask-box-image: url("image.png") 10px 20px 20px 10px space repeat;

/* Global values */
-webkit-mask-box-image: inherit;
-webkit-mask-box-image: initial;
-webkit-mask-box-image: revert;
-webkit-mask-box-image: revert-layer;
-webkit-mask-box-image: unset;

Values

<image>

The location of the image resource to be used as a mask image, <gradient>, or other <image> value.

none

Used to specify that a border box is to have no mask image.

<length>

The size of the mask image's offset. See <length> for possible units.

<percentage>

The mask image's offset has a percentage value relative to the border box's corresponding dimension (width or height).

<number>

The size of the mask image's offset in pixels.

repeat

The mask image is repeated as many times as is necessary to span the border box. May include a partial image if the mask image does not divide evenly into the border box.

stretch

The mask image is stretched to contain the border box exactly.

round

The mask image is stretched somewhat and repeated such that there is no partial mask image at the end of the border box.

space

The mask image is repeated as many times as possible without stretching. There is no partial mask image at the end of the border box.

The outset values, or edge offsets, define the distances from the top, right, bottom, and left edges of the image, in that order. The values can be set as <length>, <number>, or <percentage>, with numbers interpreted as pixel lengths.

Border repeat styles, when included, are interpreted in the order of <repeat-x> <repeat-y>. If only one value is declared, the value is the same for both axes. While similar to background-repeat, the cover and contain values are not supported.

Formal definition

Formal syntax

-webkit-mask-box-image = 
<mask-image-source> [ <mask-image-offset>{4} <mask-border-repeat>{1,2} ]

Examples

Setting an image

css
.example-one {
  -webkit-mask-box-image: url("mask.png");
}

Offsetting and filling an image

css
.example-two {
  -webkit-mask-box-image: url("logo.png") 100px 100px 0px 0px round round;
}

Specifications

Not part of any standard.

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
-webkit-mask-box-image
Non-standard
Chrome – Full support
Chrome 1 (Release date: 2008-12-11)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 3.1 (Release date: 2008-03-18)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 2 (Release date: 2008-07-11)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Full support
WebView Android 2 (Release date: 2009-10-26)
footnote Full support
WebView on iOS – Full support
WebView on iOS 2 (Release date: 2008-07-11)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Non-standard. Check cross-browser support before using.

See also