CSS mask-repeat Property
Description
The mask-repeat property controls how a mask image is tiled across an element’s painted box: whether the mask is duplicated to fill the area, how tiles are arranged, and how gaps or overlaps between tiles are treated. It operates on each mask layer independently when multiple mask images are used, so the tiling behavior you choose applies per-layer rather than globally. The property affects only the repetition of the mask artwork — not its intrinsic pixel content — and therefore directly shapes which parts of the underlying element remain visible or are hidden by repeated translucent/opaque regions.
Repetition is applied after the mask image has been sized and positioned, so the visual outcome is a combination of tiling plus those prior adjustments. For example, any scaling done by mask-size determines the tile dimensions, and the origin for laying out the tiles is influenced by mask-position. Likewise, the source(s) used as the mask are specified by mask-image, and the way they are combined with other mask layers determines the final clipping pattern.
When multiple mask layers are present, each layer’s repeat behavior is applied independently, and the resulting tiled images are then combined according to the compositing rules you’ve set for masks. The compositing step can change how overlapping tiles from different layers interact (for example, whether they multiply, add, or replace), so tiling may produce complex transparency patterns when layered; this relationship is governed by mask-composite. The general concept and visual effect of repeating a mask is analogous to how repeating works for backgrounds, though mask tiling affects alpha/transparency rather than color painting — see background-repeat for a comparable behavior on background images.
In practical use, repetition lets you turn a small alpha texture into a repeating stencil that covers an element, useful for patterned transparency, texture overlays, or creating repeated cutouts. Choosing not to repeat a mask yields a single “stamp” which can be positioned or scaled to produce a focused vignette or shaped reveal. Keep in mind that extensive tiling of large or complex masks can influence rendering cost, and the visual result depends strongly on the mask’s alpha content and how it is combined with other masking layers.
Definition
- Initial value
- repeat
- Applies to
- all elements; In SVG, it applies to container elements excluding the <defs> element and all graphics elements
- Inherited
- no
- Computed value
- Consists of two keywords, one per dimension
- Animatable
- yes
- JavaScript syntax
- object.style.maskRepeat
Syntax
mask-repeat: <repeat-style> | <repeat-style> <repeat-style>;
Values
- <repeat-style>
repeatThe mask image is repeated both horizontally and vertically (default).repeat-xThe mask image is repeated only horizontally.repeat-yThe mask image is repeated only vertically.no-repeatThe mask image is not repeated; it is shown only once.spaceThe mask image is repeated as many times as will fit, with space distributed evenly between each repetition. There is no clipping of the image.roundThe mask image is repeated and scaled so that it exactly fits the container, rounding the image size to avoid partial images.Two-value syntax You can combine horizontal and vertical values:
mask-repeat: repeat no-repeat; mask-repeat: round space;
Example
Browser Support
The following information will show you the current browser support for the CSS mask-repeat property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
