大网数据广告活动
Web 标准与前端开发

`-webkit-mask-repeat-x` CSS property

· 52CE 我爱测

The `-webkit-mask-repeat-x` property specifies whether and how a mask image is repeated (tiled) horizontally.

The -webkit-mask-repeat-x property specifies whether and how a mask image is repeated (tiled) horizontally.

Syntax

/* Keyword values */
-webkit-mask-repeat-x: repeat;
-webkit-mask-repeat-x: no-repeat;
-webkit-mask-repeat-x: space;
-webkit-mask-repeat-x: round;

/* Multiple values */
-webkit-mask-repeat-x: repeat, no-repeat, space;

/* Global values */
-webkit-mask-repeat-x: inherit;
-webkit-mask-repeat-x: initial;
-webkit-mask-repeat-x: revert;
-webkit-mask-repeat-x: revert-layer;
-webkit-mask-repeat-x: unset;

Values

This property is specified as one or more comma-separated values:

  • repeat
    • : The mask image is repeated both horizontally and vertically.
  • no-repeat
    • : The mask image is not repeated horizontally; only one copy of the mask image is drawn in that direction. The remainder of the masked element's content is not displayed.
  • 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.

Formal definition

Formal syntax

Examples

Using a repeating or non-repeating mask image

.example-one {
  -webkit-mask-image: url("mask.png");
  -webkit-mask-repeat-x: repeat;
}

.example-two {
  -webkit-mask-image: url("mask.png");
  -webkit-mask-repeat-x: no-repeat;
}

Using multiple mask images

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

.example-three {
  -webkit-mask-image: url("mask1.png"), url("mask2.png");
  -webkit-mask-repeat-x: repeat, space;
}

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

Specifications

Not part of any standard.

Browser compatibility

See also

  • mask-repeat
  • -webkit-mask-repeat-y

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。