<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>
display
attribute lets you control the rendering of graphical or container elements.
值
display="none"
indicates that the given element and its children will not be rendered. Any value other than
none
or
继承
indicates that the given element will be rendered by the browser.
When applied to a container element, setting
display
to
none
causes the container and all of its children to be invisible; thus, it acts on groups of elements as a group. This means that any child of an element with
display="none"
will never be rendered even if the child has a value for
display
除了
none
.
当
display
attribute is set to
none
, then the given element does not become part of the rendering tree. It has implications for the
<tspan>
,
<tref>
,和
<altGlyph>
elements, event processing, for bounding box calculations and for calculation of clipping paths:
display
被设为
none
在
<tspan>
,
<tref>
,或
<altGlyph>
element, then the text string is ignored for the purposes of text layout.
display
被设为
none
, the element receives no events.
display
设为
none
is not included in bounding box and clipping paths calculations.
display
attribute only affects the direct rendering of a given element, whereas it does not prevent elements from being referenced by other elements. For example, setting it to
none
在
<path>
element will prevent that element from getting rendered directly onto the canvas, but the
<path>
element can still be referenced by a
<textPath>
element; furthermore, its geometry will be used in text-on-a-path processing even if the
<path>
拥有
display
value of
none
.
This attribute also affects direct rendering into offscreen canvases, such as occurs with masks or clip paths. Thus, setting
display="none"
on a child of a
<mask>
will prevent the given child element from being rendered as part of the mask. Similarly, setting
display="none"
on a child of a
<clipPath>
element will prevent the given child element from contributing to the clipping path.
注意:
As a presentation attribute,
display
can be used as a CSS property. See
css display
了解进一步信息。
You can use this attribute with any SVG element.
<svg viewBox="0 0 220 100" xmlns="http://www.w3.org/2000/svg">
<!-- Here the yellow rectangle is displayed -->
<rect x="0" y="0" width="100" height="100" fill="skyblue"></rect>
<rect x="20" y="20" width="60" height="60" fill="yellow"></rect>
<!-- Here the yellow rectangle is not displayed -->
<rect x="120" y="0" width="100" height="100" fill="skyblue"></rect>
<rect x="140" y="20" width="60" height="60" fill="yellow" display="none"></rect>
</svg>
| 默认值 |
inline
|
|---|---|
| 值 |
[ <display-outside> || <display-inside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy> |
| Animatable | Yes |
For a description of the values, please refer to the
css display
特性。
| 规范 | 状态 | 注释 |
|---|---|---|
|
Scalable Vector Graphics (SVG) 2
The definition of 'display' in that specification. |
候选推荐 |
Refers to the CSS 2 specification of the
display
property,
but outlines the differences regarding SVG.
|
|
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'display' in that specification. |
推荐 | 初始定义 |
BCD tables only load in the browser
最后修改: , 由 MDN 贡献者