<a>
<defs>
<g>
<marker>
<mask>
<missing-glyph>
<pattern>
<svg>
<switch>
<symbol>
<feBlend>
<feColorMatrix>
<feComponentTransfer>
<feComposite>
<feConvolveMatrix>
<feDiffuseLighting>
<feDisplacementMap>
<feDistantLight>
<feFlood>
<feFuncA>
<feFuncB>
<feFuncG>
<feFuncR>
<feGaussianBlur>
<feImage>
<feMerge>
<feMergeNode>
<feMorphology>
<feOffset>
<fePointLight>
<feSpecularLighting>
<feSpotLight>
<feTile>
<feTurbulence>
<filter>
<font>
<font-face>
<font-face-format>
<font-face-name>
<font-face-src>
<font-face-uri>
<foreignObject>
<mask>
element defines an alpha mask for compositing the current object into the background. A mask is used/referenced using the
mask
特性。
<svg viewBox="-10 -10 120 120">
<mask id="myMask">
<!-- Everything under a white pixel will be visible -->
<rect x="0" y="0" width="100" height="100" fill="white" />
<!-- Everything under a black pixel will be invisible -->
<path d="M10,35 A20,20,0,0,1,50,35 A20,20,0,0,1,90,35 Q90,65,50,95 Q10,65,10,35 Z" fill="black" />
</mask>
<polygon points="-10,110 110,110 110,-10" fill="orange" />
<!-- with this mask applied, we "punch" a heart shape hole into the circle -->
<circle cx="50" cy="50" r="50" mask="url(#myMask)" />
</svg>
height
This attribute defines the height of the masking area.
Value type
:
<length>
;
默认值
:
120%
;
Animatable
:
yes
maskContentUnits
This attribute defines the coordinate system for the contents of the
<mask>
.
Value type
:
userSpaceOnUse
|
objectBoundingBox
;
默认值
:
userSpaceOnUse
;
Animatable
:
yes
maskUnits
This attribute defines the coordinate system for attributes
x
,
y
,
width
and
height
在
<mask>
.
Value type
:
userSpaceOnUse
|
objectBoundingBox
;
默认值
:
objectBoundingBox
;
Animatable
:
yes
x
This attribute defines the x-axis coordinate of the top-left corner of the masking area.
Value type
:
<coordinate>
;
默认值
:
-10%
;
Animatable
:
yes
y
This attribute defines the y-axis coordinate of the top-left corner of the masking area.
Value type
:
<coordinate>
;
默认值
:
-10%
;
Animatable
:
yes
width
This attribute defines the width of the masking area.
Value type
:
<length>
;
默认值
:
120%
;
Animatable
:
yes
Most notably:
id
class
,
style
Most notably:
requiredExtensions
,
systemLanguage
Most notably:
clip-path
,
clip-rule
,
color
,
display
,
fill
,
fill-opacity
,
fill-rule
,
filter
,
mask
,
opacity
,
shape-rendering
,
stroke
,
stroke-dasharray
,
stroke-dashoffset
,
stroke-linecap
,
stroke-linejoin
,
stroke-miterlimit
,
stroke-opacity
,
stroke-width
,
transform
,
vector-effect
,
visibility
| 类别 | 容器元素 |
|---|---|
| 准许内容 |
Any number of the following elements, in any order:
Animation elements Descriptive elements Shape elements Structural elements Gradient elements
<a>
,
<altGlyphDef>
,
<clipPath>
,
<color-profile>
,
<cursor>
,
<filter>
,
<font>
,
<font-face>
,
<foreignObject>
,
<image>
,
<marker>
,
<mask>
,
<pattern>
,
<script>
,
<style>
,
<switch>
,
<text>
,
<view>
|
| 规范 |
|---|
|
CSS Masking Module Level 1
(CSS Masking 1)
# MaskElement |
BCD tables only load in the browser
<clipPath>
mask
,
mask-image
,
mask-mode
,
mask-repeat
,
mask-position
,
mask-clip
,
mask-origin
,
mask-composite
,
mask-size
,
pointer-events
最后修改: , 由 MDN 贡献者