---
title: mask
slug: Web/SVG/Element/mask
tags:
- SVG
- SVG容器
- 元素
translation_of: Web/SVG/Element/mask
---
{{SVGRef}}
在SVG中,你可以指一个透明的遮罩层和当前对象合成,形成背景。透明遮罩层可以是任何其他图形对象或者{{ SVGElement("g") }}元素。mask
元素用于定义这样的遮罩元素。属性{{ SVGAttr("mask") }}用来引用一个遮罩元素。
使用场景
{{svginfo}}
示例
» mask.svg
属性
全局属性
- 条件处理属性 »
- 核心属性 »
- 外观属性 »
- {{ SVGAttr("class") }}
- {{ SVGAttr("style") }}
- {{ SVGAttr("externalResourcesRequired") }}
专有属性
- {{ SVGAttr("maskUnits") }}
- {{ SVGAttr("maskContentUnits") }}
- {{ SVGAttr("x") }}
- {{ SVGAttr("y") }}
- {{ SVGAttr("width") }}
- {{ SVGAttr("height") }}
DOM 接口
该元素实现了SVGMaskElement
接口。
参见
- {{ SVGElement("clipPath") }}