Proprietà mask-origin CSS

Definition and usage

mask-origin The attribute specifies the original position of the mask layer image (i.e., the mask position area).

Example

Display mask-origin Different values of the attribute:

.masked {
  background: green;
  border: 30px solid blue;
  padding: 20px;
  -webkit-mask-image: url(img_circle.svg);
  mask-image: url(img_circle.svg);
  mask-size: 50%;
  mask-repeat: no-repeat;
}
.mask1 {
  mask-origin: border-box;
}
.mask2 {
  mask-origin: content-box;
}
.mask3 {
  mask-origin: padding-box;
}
.mask4 {
  mask-origin: fill-box;
}

Try it yourself

CSS Syntax

mask-origin: border-box|content-box|padding-box|fill-box|stroke-box|view-box|initial|inherit;

Attribute value

Value Description
border-box Position relative to the border box. Default value.
content-box Position relative to the content box.
padding-box Position relative to the inner border box.
fill-box Position relative to the object boundary box.
stroke-box Position relative to the stroke boundary box.
view-box Uses the nearest SVG viewport as the reference box.
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical details

Default value: border-box
Inheritance: No
Animation creation: Not supported. See:Animation-related properties.
Version: CSS Masking Module Level 1
JavaScript Syntax: object.style.maskOrigin="padding-box"

Browser support

The numbers in the table represent the first browser version to fully support this property.

Chrome Edge Firefox Safari Opera
120 120 53 15.4 106

Pagine correlate

Tutorial:Soffietto CSS

Riferimento:Proprietà mask CSS

Riferimento:Proprietà mask-clip CSS

Riferimento:Proprietà mask-composite CSS

Riferimento:Proprietà mask-image CSS

Riferimento:Proprietà mask-mode CSS

Riferimento:Proprietà mask-position CSS

Riferimento:Proprietà mask-repeat CSS

Riferimento:Proprietà mask-size CSS

Riferimento:Proprietà mask-type CSS