mask-repeat
Quick Summary for mask-repeat
The mask-repeat CSS 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.
Code Usage for mask-repeat
/* One-value syntax */ mask-repeat: repeat-x; mask-repeat: repeat-y; mask-repeat: repeat; mask-repeat: space; mask-repeat: round; mask-repeat: no-repeat;  /* Two-value syntax: horizontal | vertical */ mask-repeat: repeat space; mask-repeat: repeat repeat; mask-repeat: round space; mask-repeat: no-repeat round;  /* Multiple values */ mask-repeat: space round, no-repeat; mask-repeat: round repeat, space, repeat-x;  /* Global values */ mask-repeat: inherit; mask-repeat: initial; mask-repeat: revert; mask-repeat: unset; 
More Details for mask-repeat

mask-repeat

The mask-repeat CSS 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.

/* One-value syntax */ mask-repeat: repeat-x; mask-repeat: repeat-y; mask-repeat: repeat; mask-repeat: space; mask-repeat: round; mask-repeat: no-repeat;  /* Two-value syntax: horizontal | vertical */ mask-repeat: repeat space; mask-repeat: repeat repeat; mask-repeat: round space; mask-repeat: no-repeat round;  /* Multiple values */ mask-repeat: space round, no-repeat; mask-repeat: round repeat, space, repeat-x;  /* Global values */ mask-repeat: inherit; mask-repeat: initial; mask-repeat: revert; mask-repeat: unset; 

By default, the repeated images are clipped to the size of the element, but they can be scaled to fit (using round) or evenly distributed from end to end (using space).

Syntax

One or more <repeat-style> values, separated by commas.

Values

<repeat-style>

The one-value syntax is a shorthand for the full two-value syntax:

Single value Two-value equivalent
repeat-x repeat no-repeat
repeat-y no-repeat repeat
repeat repeat repeat
space space space
round round round
no-repeat no-repeat no-repeat

In the two-value syntax, the first value represents the horizontal repetition behavior and the second value represents the vertical behavior. Here is an explanation of how each option works for either direction:

repeat The image is repeated as much as needed to cover the whole mask painting area. The last image will be clipped if it doesn't fit.
space The image is repeated as much as possible without clipping. The first and last images are pinned to either side of the element, and whitespace is distributed evenly between the images. The mask-position property is ignored unless only one image can be displayed without clipping. The only case where clipping happens using space is when there isn't enough room to display one image.
round As the allowed space increases in size, the repeated images will stretch (leaving no gaps) until there is room for another one to be added. When the next image is added, all of the current ones compress to allow room. Example: An image with an original width of 260px, repeated three times, might stretch until each repetition is 300px wide, and then another image will be added. They will then compress to 225px.
no-repeat The image is not repeated (and hence the mask painting area will not necessarily be entirely covered). The position of the non-repeated mask image is defined by the mask-position CSS property.

Formal definition

Initial valueno-repeat
Applies toall elements; In SVG, it applies to container elements excluding the defs element and all graphics elements
Inheritedno
Computed valueConsists of two keywords, one per dimension
Animation typediscrete

Formal syntax

<repeat-style>#

where <repeat-style> = repeat-x | repeat-y | [ repeat | space | round | no-repeat ]{1,2}

Examples

Setting repeat for a single mask

Multiple mask image support

You can specify a different <repeat-style> for each mask image, separated by commas:

.examplethree {   mask-image: url('mask1.png'), url('mask2.png');   mask-repeat: repeat-x, repeat-y; } 

Each image is matched with the corresponding repeat style, from first specified to last.

Specifications

Specification
CSS Masking Module Level 1 # the-mask-repeat

See also

Clipping and Masking in CSS

Last modified: Nov 12, 2021, by MDN contributors

Select your preferred language English (US)DeutschEspañolFrançais日本語中文 (简体) Change language

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Categories in CSS
css
Search CSS
Search CSS by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

You could also follow me on twitter. I have a couple of youtube channels if you want to see some video related content. RuneScape 3, Minecraft and also a coding channel here Web Dev.

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote

"Olivia, my eldest daughter, caught measles when she was seven years old. As the illness took its usual course I can remember reading to her often in bed and not feeling particularly alarmed about it. Then one morning, when she was well on the road to recovery, I was sitting on her bed showing her how to fashion little animals out of coloured pipe-cleaners, and when it came to her turn to make one herself, I noticed that her fingers and her mind were not working together and she couldn’t do anything. 'Are you feeling all right?' I asked her. 'I feel all sleepy,' she said. In an hour, she was unconscious. In twelve hours she was dead. The measles had turned into a terrible thing called measles encephalitis and there was nothing the doctors could do to save her. That was...in 1962, but even now, if a child with measles happens to develop the same deadly reaction from measles as Olivia did, there would still be nothing the doctors could do to help her. On the other hand, there is today something that parents can do to make sure that this sort of tragedy does not happen to a child of theirs. They can insist that their child is immunised against measles. ...I dedicated two of my books to Olivia, the first was ‘James and the Giant Peach’. That was when she was still alive. The second was ‘The BFG’, dedicated to her memory after she had died from measles. You will see her name at the beginning of each of these books. And I know how happy she would be if only she could know that her death had helped to save a good deal of illness and death among other children."

I just checked google books for BFG, and the dedication is there. 

https://www.google.com.au/books/edition/_/quybcXrFhCIC?hl=en&gbpv=1 


Roald Dahl, 1986
Random CSS Property

blur()

The blur() CSS function applies a Gaussian blur to the input image. Its result is a <filter-function>.
blur() css reference