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);
  -webkit-mask-size: 70%;
  mask-size: 70%;
  -webkit-mask-repeat: no-repeat;
  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: CSS3
JavaScript syntax: object.style.maskSize="100px 200px"

Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Numbers followed by -webkit- specify the first version that worked with a prefix.

Property
mask-size 4.0 -webkit- 79.0 -webkit- 53.0 4.0 -webkit- 15.0 -webkit-

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);
  -webkit-mask-size: 200px 200px;
  mask-size: 200px 200px;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
Try it Yourself »

Related Pages

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


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.