CSS mask-position property
Browser support · legacy reference
ChromePartial support
SafariPartial support
FirefoxPartial support
Internet ExplorerPartial support
EdgePartial support
OperaPartial support
Description
The mask images can be positioned within the mask positioning area by using the keywords or percentage values given below.
There are always two values of mask-position (horizontal and vertical offset). If only one value is specified the other one is assumed to be 50% or center.
Syntax
mask-position : [ percentage | length | left | center | right] [percentage | length | top | center | bottom]
Property values
X-percentage Y-percentageDefault
-
Horizontal offset is 0% which means 0% width of the image is under 0% width of the mask positioning area from the left side.
Vertical offset is 0% which means that 0% height of the image is under 70% height of the mask position area from the top side.
- Try it
mask-position: 0% 0%; X-percentage Y-percentage
-
Horizontal offset is 40% which means 40% width of the image is under 40% width of the mask positioning area from the left side.
Vertical offset is 70% which means that 70% height of the image is under 70% height of the mask position area from the top side.
- Try it
mask-position: 40% 70%; XY-percentage
-
One value is 30%. The other value is 50% (by default).
It is the same as mask-position: 30% 50%;.
- Try it
mask-position: 30%; left
-
The image is aligned on the left side horizontally. And it is aligned at the center vertically (by default).
It is the same as left center or 0% 50%.
- Try it
mask-position: left; center
-
This value aligns an image horizontally and vertically at the center.
It computes to center center or 50% 50%.
- Try it
mask-position: center; right
-
This value aligns an image horizontally on the right side and vertically at the center.
It is the same as right center or 100% 50%
- Try it
mask-position: right; top
-
top value aligns an image horizontally at the center and vertically at the top.
It is the same as center top or 50% 0%.
- Try it
mask-position: top; bottom
-
bottom value aligns an image horizontally at the bottom and vertically at the bottom.
It is the same as center bottom or 50% 100%.
- Try it
mask-position: bottom;
Applicable to
It applies to all elements