docs.rodeo

MDN Web Docs mirror

mask-border-slice

{{CSSRef}} 

The mask-border-slice CSS property divides the image set by {{cssxref("mask-border-source")}}  into regions. These regions are used to form the components of an element’s mask border.

Syntax

/* All sides */
mask-border-slice: 30%;

/* top and bottom | left and right */
mask-border-slice: 10% 30%;

/* top | left and right | bottom */
mask-border-slice: 30 30% 45;

/* top | right | bottom | left */
mask-border-slice: 7 12 14 5;

/* Using the `fill` keyword */
mask-border-slice: 10% fill 7 12;

/* Global values */
mask-border-slice: inherit;
mask-border-slice: initial;
mask-border-slice: revert;
mask-border-slice: revert-layer;
mask-border-slice: unset;

The mask-border-slice property may be specified using one to four <number-percentage> values to represent the position of each image slice. Negative values are invalid; values greater than their corresponding dimension are clamped to 100%.

The optional fill value, if used, can be placed anywhere in the declaration.

Values

Description

The slicing process creates nine regions in total: four corners, four edges, and a middle region. Four slice lines, set a given distance from their respective sides, control the size of the regions.

The nine regions defined by the border-image or border-image-slice properties

The above diagram illustrates the location of each region.

The {{cssxref("mask-border-repeat")}} , {{cssxref("mask-border-width")}} , and {{cssxref("mask-border-outset")}}  properties determine how these regions are used to form the final mask border.

Formal definition

{{cssinfo}} 

Formal syntax

{{csssyntax}} 

Examples

Basic usage

mask-border-slice serves to define the size of the slices taken from the source image, and is used to create the border mask.

mask-border-slice: 30 fill;

Chromium-based browsers support an outdated version of this property — mask-box-image-slice — with a prefix:

-webkit-mask-box-image-slice: 30 fill;

[!NOTE] The mask-border page features a working example (using the out-of-date prefixed border mask properties supported in Chromium), so you can get an idea of the effect.

[!NOTE] The fill keyword needs to be included if you want the element’s content to be visible.

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN