CSS mask-repeat Property
Example
.example {
-webkit-mask-image: url(hello-world.png);
mask-image: url(hello-world.png);
-webkit-mask-size: 60%;
mask-size: 60%;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
}
Meaning
The mask-repeat property sets how mask images are repeated.
A mask image can be repeated along the horizontal axis, the vertical axis, both axes, or not repeated at all.
Default value: | repeat |
Inherited: | No |
Animatable: | No |
Version: | CSS3 |
JavaScript syntax: |
|
Standard Syntax
mask-repeat: repeat|repeat-x|repeat-y|space|round|no-repeat|initial|inherit|revert|revert-layer|unset;
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Status
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
repeat | This is default. Specifies The mask image is repeated both vertically and horizontally. The last image will be clipped if it does not fit. |
repeat-x | Specifies the mask image is repeated only horizontally. |
repeat-y | Specifies the mask image is repeated only vertically. |
space | Specifies the mask image is repeated as much as possible without clipping. The first and last image is pinned to either side of the element, and whitespace is distributed evenly between the images. |
round | Specifies the mask image is repeated and squished or stretched to fill the space (no gaps). |
no-repeat | Specifies the mask image is not repeated. The image will only be shown once. |
initial | Sets this property to its default value. |
inherit | If specified, the associated element takes the computed value of its parent element animation-delay property. |
revert | Reverts the cascaded value of the property from its current value to the value the property |
revert-layer | Rollback styles to the ones specified in previous cascade layers. |
unset | Resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not. |
Default CSS Property Values
selectors {
mask-repeat: repeat;
}
More Examples
This is the mask image:
And this is an image of flowers:
After apply the mask image as the mask layer for the image flowers:
Example
<style type="text/css">
img {
-webkit-mask-image: url(hello-world.png);
mask-image: url(hello-world.png);
-webkit-mask-size: 100%;
mask-size: 100%;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
}
</style>
<img src="flowers.jpg" width="200" height="200">