mask-border-slice
Quick Summary for mask-border-slice
The mask-border-slice CSS property divides the image set by mask-border-source into regions. These regions are used to form the components of an element's mask border.
Code Usage for mask-border-slice
/* All sides */ mask-border-slice: 30%;  /* vertical | horizontal */ mask-border-slice: 10% 30%;  /* top | horizontal | 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: unset; 
More Details for mask-border-slice

mask-border-slice

The mask-border-slice CSS property divides the image set by 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%;  /* vertical | horizontal */ mask-border-slice: 10% 30%;  /* top | horizontal | 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: 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%.

When one position is specified, it creates all four slices at the same distance from their respective sides. When two positions are specified, the first value creates slices measured from the top and bottom, the second creates slices measured from the left and right. When three positions are specified, the first value creates a slice measured from the top, the second creates slices measured from the left and right, the third creates a slice measured from the bottom. When four positions are specified, they create slices measured from the top, right, bottom, and left in that order (clockwise).

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

Values

<number>

Represents an edge offset in pixels for raster images and coordinates for vector images. For vector images, the number is relative to the element's size, not the size of the source image, so percentages are generally preferable in these cases.

<percentage>

Represents an edge offset as a percentage of the source image's size: the width of the image for horizontal offsets, the height for vertical offsets.

fill

Preserves the middle image region. Its width and height are sized to match the top and left image regions, respectively.

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 above diagram illustrates the location of each region.

Zones 1-4 are corner regions. Each one is used a single time to form the corners of the final border image. Zones 5-8 are edge regions. These are repeated, scaled, or otherwise modified in the final border image to match the dimensions of the element. Zone 9 is the middle region. It is discarded by default, but is used like a background image if the keyword fill is set.

The mask-border-repeat, mask-border-width, and mask-border-outset properties determine how these regions are used to form the final mask border.

Formal definition

Initial value0
Applies toall elements; In SVG, it applies to container elements excluding the defs element and all graphics elements
Inheritedno
Percentagesrefer to size of the mask border image
Computed valueas specified
Animation typediscrete

Formal syntax

<number-percentage>{1,4} fill?

where <number-percentage> = <number> | <percentage>

Examples

Basic usage

This property doesn't appear to be supported anywhere yet. When it eventually starts to be supported, it will serve to define the size of the slices taken from the source image, and 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

Specification
CSS Masking Module Level 1 # the-mask-border-slice

See also

mask-border mask-border-mode mask-border-outset mask-border-repeat mask-border-source mask-border-width Illustrated description of the 1-to-4-value syntax

Last modified: Aug 12, 2021, by MDN contributors

Select your preferred language English (US)Français日本語中文 (简体) Change language

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Categories in CSS
css
Search CSS
Search CSS by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote

"Olivia, my eldest daughter, caught measles when she was seven years old. As the illness took its usual course I can remember reading to her often in bed and not feeling particularly alarmed about it. Then one morning, when she was well on the road to recovery, I was sitting on her bed showing her how to fashion little animals out of coloured pipe-cleaners, and when it came to her turn to make one herself, I noticed that her fingers and her mind were not working together and she couldn’t do anything. 'Are you feeling all right?' I asked her. 'I feel all sleepy,' she said. In an hour, she was unconscious. In twelve hours she was dead. The measles had turned into a terrible thing called measles encephalitis and there was nothing the doctors could do to save her. That was...in 1962, but even now, if a child with measles happens to develop the same deadly reaction from measles as Olivia did, there would still be nothing the doctors could do to help her. On the other hand, there is today something that parents can do to make sure that this sort of tragedy does not happen to a child of theirs. They can insist that their child is immunised against measles. ...I dedicated two of my books to Olivia, the first was ‘James and the Giant Peach’. That was when she was still alive. The second was ‘The BFG’, dedicated to her memory after she had died from measles. You will see her name at the beginning of each of these books. And I know how happy she would be if only she could know that her death had helped to save a good deal of illness and death among other children."

I just checked google books for BFG, and the dedication is there. 

https://www.google.com.au/books/edition/_/quybcXrFhCIC?hl=en&gbpv=1 


Roald Dahl, 1986
Random CSS Property

border-block-color

The border-block-color CSS property defines the color of the logical block borders of an element, which maps to a physical border color depending on the element's writing mode, directionality, and text orientation. It corresponds to the border-top-color and border-bottom-color, or border-right-color and border-left-color property depending on the values defined for writing-mode, direction, and text-orientation.
border-block-color css reference