blob: 36bd6932a5a4d6cbc410505ac6e2103e4f35fffb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
---
title: visibility
slug: Web/SVG/Attribute/visibility
tags:
- SVG
- SVG属性
- 需要兼容性表
translation_of: Web/SVG/Attribute/visibility
---
<p>« <a href="/en/SVG/Attribute" title="en/SVG/Attribute">SVG属性参考主页</a></p>
<p><code>visibility</code>属性让你能够控制一个图形元素的可见性。用了值<code>hidden</code>或者值<code>collapse</code>,当前的图形元素将不可见。</p>
<div class="note"><strong>注意:</strong>如果 {{ SVGElement("tspan") }}元素、{{ SVGElement("tref") }}元素或{{ SVGElement("altGlyph") }}元素上的<code>visibility</code>属性设置为<code>hidden</code>,则文本变得不可见,但是依然占用文本布局计算的空间。</div>
<p>根据属性{{ SVGAttr("pointer-events") }}的值,图形元素如果属性<code>visibility值设置为hidden,依然能够响应事件。</code></p>
<p>作为一个外观属性,它可以直接用作CSS样式表内部的属性。请阅读{{ cssxref("visibility","CSS visibility") }}以了解更多信息。</p>
<h2 id="用法">用法</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">类别</th>
<td>外观属性</td>
</tr>
<tr>
<th scope="row">值</th>
<td><strong title="this is the default value">visible</strong> | hidden | collapse | inherit</td>
</tr>
<tr>
<th scope="row">可变性</th>
<td>Yes</td>
</tr>
<tr>
<th scope="row">规范文档</th>
<td><a class="external" href="http://www.w3.org/TR/SVG11/painting.html#VisibilityProperty">SVG 1.1 (2nd Edition)</a></td>
</tr>
</tbody>
</table>
<h2 id="示例">示例</h2>
<h2 id="元素">元素</h2>
<p>下列元素楞以使用<code>visibility</code>属性:</p>
<ul>
<li><a href="/en/SVG/Element#Graphics" title="en/SVG/Element#Graphics">图形元素</a> »</li>
<li><a href="/en/SVG/Element#Text_content_elements" title="en/SVG/Element#Text_content_elements">文本内容元素</a> »</li>
</ul>
<h2 id="参见">参见</h2>
<ul>
<li>属性{{ SVGAttr("display") }} </li>
<li>{{ cssxref("visibility","CSS visibility") }}</li>
</ul>
|