mask-clip CSS property determines the area which is affected by a mask. The painted content of an element must be restricted to this area.

/* <geometry-box> values */
mask-clip: content-box;
mask-clip: padding-box;
mask-clip: border-box;
mask-clip: margin-box;
mask-clip: fill-box;
mask-clip: stroke-box;
mask-clip: view-box;
/* Keyword values */
mask-clip: no-clip;
/* Non-standard keyword values */
-webkit-mask-clip: border;
-webkit-mask-clip: padding;
-webkit-mask-clip: content;
-webkit-mask-clip: text;
/* Multiple values */
mask-clip: padding-box, no-clip;
mask-clip: view-box, fill-box, border-box;
/* Global values */
mask-clip: inherit;
mask-clip: initial;
mask-clip: unset;
					

句法

One or more of the keyword values listed below, separated by commas.

content-box

The painted content is clipped to the content box.

padding-box

The painted content is clipped to the padding box.

border-box

The painted content is clipped to the border box.

margin-box

The painted content is clipped to the margin box.

fill-box

The painted content is clipped to the object bounding box.

stroke-box

The painted content is clipped to the stroke bounding box.

view-box
Uses the nearest SVG viewport as reference box. If a viewBox attribute is specified for the element creating the SVG viewport, the reference box is positioned at the origin of the coordinate system established by the viewBox attribute and the dimension of the reference box is set to the width and height values of the viewBox 属性。
no-clip

The painted content is not clipped.

border
This keyword behaves the same as border-box .
padding
This keyword behaves the same as padding-box .
content
This keyword behaves the same as content-box .
text

This keyword clips the mask image to the text of the element.

形式定义

初始值 border-box
适用于 all elements; In SVG, it applies to container elements excluding the defs element and all graphics elements
继承 no
计算值 如指定
动画类型 discrete

形式句法

[ <geometry-box> | no-clip ]#

where
<geometry-box> = <shape-box> | fill-box | stroke-box | view-box

where
<shape-box> = <box> | margin-box

where
<box> = border-box | padding-box | content-box

范例

Clipping a mask to the border box

Change the mask-clip value to any of the allowed values detailed above. If viewing the example in a Chromium-based browser change the value of -webkit-mask-clip .

规范

规范 状态 注释
CSS Masking Module Level 1
The definition of 'mask-clip' in that specification.
候选推荐 初始定义

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
mask-clip Chrome 完整支持 1 Prefixed
完整支持 Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Edge 完整支持 79 Prefixed
完整支持 Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Firefox 完整支持 53
完整支持 53
不支持 20 — 53 Disabled
Disabled ). To change preferences in Firefox, visit
IE 不支持 No Opera 完整支持 15 Prefixed
完整支持 Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Safari 完整支持 4 Prefixed
完整支持 Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
WebView Android 完整支持 2 Prefixed
完整支持 Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Chrome Android 完整支持 18 Prefixed
完整支持 Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Firefox Android 完整支持 53
完整支持 53
不支持 20 — 53 Disabled
Disabled ). To change preferences in Firefox, visit
Opera Android 完整支持 14 Prefixed
完整支持 Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Safari iOS 完整支持 3.2 Prefixed
完整支持 Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Samsung Internet Android 完整支持 1.0 Prefixed
完整支持 Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
border 非标 Chrome 完整支持 1 Edge 完整支持 79 Firefox 不支持 No IE 不支持 No Opera 完整支持 15 Safari 完整支持 4 WebView Android 完整支持 2 Chrome Android 完整支持 18 Firefox Android 不支持 No Opera Android 完整支持 14 Safari iOS 完整支持 3.2 Samsung Internet Android 完整支持 1.0
content</content> 非标 Chrome 完整支持 1 Edge 完整支持 79 Firefox 不支持 No IE 不支持 No Opera 完整支持 15 Safari 完整支持 4 WebView Android 完整支持 2 Chrome Android 完整支持 18 Firefox Android 不支持 No Opera Android 完整支持 14 Safari iOS 完整支持 3.2 Samsung Internet Android 完整支持 1.0
padding 非标 Chrome 完整支持 1 Edge 完整支持 79 Firefox 不支持 No IE 不支持 No Opera 完整支持 15 Safari 完整支持 4 WebView Android 完整支持 2 Chrome Android 完整支持 18 Firefox Android 不支持 No Opera Android 完整支持 14 Safari iOS 完整支持 3.2 Samsung Internet Android 完整支持 1.0
text 非标 Chrome 完整支持 1 Edge 完整支持 79 Firefox 不支持 No IE 不支持 No Opera 完整支持 15 Safari 完整支持 4 WebView Android 完整支持 2 Chrome Android 完整支持 18 Firefox Android 不支持 No Opera Android 完整支持 14 Safari iOS 完整支持 3.2 Samsung Internet Android 完整支持 1.0

图例

完整支持

完整支持

不支持

不支持

非标。预期跨浏览器支持较差。

非标。预期跨浏览器支持较差。

用户必须明确启用此特征。

用户必须明确启用此特征。

要求使用供应商前缀或不同名称。

要求使用供应商前缀或不同名称。

元数据

  • 最后修改:
  1. CSS
  2. CSS 参考
  3. CSS Masking
  4. 特性
    1. clip
    2. clip-path
    3. mask
    4. mask-border
    5. mask-border-mode
    6. mask-border-outset
    7. mask-border-repeat
    8. mask-border-slice
    9. mask-border-source
    10. mask-border-width
    11. mask-clip
    12. mask-composite
    13. mask-image
    14. mask-mode
    15. mask-origin
    16. mask-position
    17. mask-repeat
    18. mask-size
    19. mask-type

Copyright  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1