CSS mask-size Property
Example
Set the size (in percent) for the mask layer image:
.mask1 {
-webkit-mask-image: url(w3logo.png);
mask-image: url(w3logo.png);
mask-size: 70%;
mask-repeat: no-repeat;
}
Try it Yourself »
More "Try it Yourself" examples below.
Definition and Usage
The mask-size
property specifies the size of
the mask layer image.
Default value: | auto |
---|---|
Inherited: | no |
Animatable: | no. Read about animatable |
Version: | CSS Masking Module Level 1 |
JavaScript syntax: | object.style.maskSize="100px 200px" |
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
mask-size | 120 | 120 | 53 | 15.4 | 106 |
CSS Syntax
mask-size: auto|size|contain|cover|initial|inherit;
Property Values
Value | Description |
---|---|
auto | This is default |
size | Specifies the size of the mask image in px, em, etc, or in % |
contain | Scales the mask image in a way that both its width and its height fit inside the container |
cover | Scales the mask image in a way that both its width and its height cover the container |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
More Examples
Example
Set the size (in pixels) for the mask layer image:
.mask1 {
-webkit-mask-image: url(w3logo.png);
mask-image: url(w3logo.png);
mask-size: 200px 200px;
mask-repeat: no-repeat;
}
Try it Yourself »
Related Pages
CSS reference: mask property
CSS reference: mask-clip property
CSS reference: mask-composite property
CSS reference: mask-image property
CSS reference: mask-mode property
CSS reference: mask-origin property
CSS reference: mask-position property
CSS reference: mask-repeat property
CSS tutorial: CSS Masking