Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

mask-position

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.

Summary

The mask-position CSS property sets the initial position, relative to the mask position layer defined by mask-origin for each defined mask image.

Initial valuecenter
Applies toall elements; In SVG, it applies to container elements excluding the <defs> element and all graphics elements
Inheritedno
Percentagesrefer to size of mask painting area minus size of mask layer image (see the text for background-position)
Mediavisual
Computed valueConsists of two keywords representing the origin and two offsets from that origin, each given as an absolute length (if given a <length>), otherwise as a percentage.
Animation typea repeatable list of , a simple list of , a length, percentage or calc();
Canonical orderthe unique non-ambiguous order defined by the formal grammar

Syntax

/* Keyword values */
mask-position: top;
mask-position: bottom;
mask-position: left;
mask-position: right;
mask-position: center;

/*  values */
mask-position: 25% 75%;

/*  values */
mask-position: 0px 0px;
mask-position: 1cm 2cm;
mask-position: 10ch 8em;

/* Multiple values */
mask-position: 0px 0px, center;

/* Global values */
mask-position: inherit;
mask-position: initial;
mask-position: unset;

Values

<position>
Is a <position>, that is one to four values representing a 2D position regarding the edges of the element's box. Relative or absolute offsets can be given. Note that the position can be set outside of the element's box.

Formal syntax

<position>#

where
<position> = [[ left | center | right | top | bottom | <length-percentage> ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ] | [ center | [ left | right ] <length-percentage>? ] && [ center | [ top | bottom ] <length-percentage>? ]]

where
<length-percentage> = <length> | <percentage>

Example

.exampleOne {
  mask-image: url(mask.png);
  mask-position: bottom right;
}

.exampleTwo {
  mask-image: url(mask.png);
  mask-position: 25%;
} 

Specifications

Specification Status Comment
CSS Masking Level 1
The definition of 'mask-position' in that specification.
Candidate Recommendation Initial definition

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1.0-webkit No support[2] ? ? 4.0-webkit
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support ? No support[1] ? ? ?

[1] Gecko currently doesn't implement this feature. It is only available in Nightly and Dev Edition. See bug 1251161.

Document Tags and Contributors

 Contributors to this page: teoli, Sebastianz
 Last updated by: teoli,