aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/svg/attribute/opacity/index.html
blob: 0dbb4a73bbc5b88f8b20f9de7bd2fee355398749 (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
60
61
62
63
64
65
66
67
68
69
---
title: opacity
slug: Web/SVG/Attribute/opacity
tags:
  - SVG
  - SVG属性
  - 需要兼容性表
  - 需要示例
translation_of: Web/SVG/Attribute/opacity
---
<p>« <a href="/en/SVG/Attribute" title="en/SVG/Attribute">SVG属性参考主页</a></p>

<p>opacity属性指定了一个对象或一组对象的透明度,也就是说,元素后面的背景的透过率。</p>

<p>作为一个外观属性,它可以直接用作CSS样式表内部的属性,请阅读 {{ cssxref("opacity","CSS opacity") }}以了解更多信息。</p>

<h2 id="用法">用法</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="row">类别</th>
   <td>外观属性</td>
  </tr>
  <tr>
   <th scope="row"></th>
   <td>&lt;opacity-value&gt; | 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/masking.html#OpacityProperty">SVG 1.1 (2nd Edition)</a></td>
  </tr>
 </tbody>
</table>

<dl>
 <dt>&lt;opacity-value&gt;</dt>
 <dd>一致的不透明度设置,作为一个<a href="/en/SVG/Content_type#Number" title="en/SVG/Content_type#Number">&lt;number&gt;</a>被应用到整个对象上。任何超过范围0.0到1.0的值都会被压回这个范围。0.0表示完全透明,1.0表示完全不透明。</dd>
</dl>

<h2 id="示例">示例</h2>

<h2 id="元素">元素</h2>

<p>以下元素可以使用<code>opacity</code>属性:</p>

<ul>
 <li><a href="/en/SVG/Element#Graphics" title="en/SVG/Element#Graphics">图形元素</a> »</li>
 <li>{{ SVGElement("a") }}</li>
 <li>{{ SVGElement("defs") }}</li>
 <li>{{ SVGElement("glyph") }}</li>
 <li>{{ SVGElement("g") }}</li>
 <li>{{ SVGElement("marker") }}</li>
 <li>{{ SVGElement("missing-glyph") }}</li>
 <li>{{ SVGElement("pattern") }}</li>
 <li>{{ SVGElement("svg") }}</li>
 <li>{{ SVGElement("switch") }}</li>
 <li>{{ SVGElement("symbol") }}</li>
</ul>

<h2 id="参见">参见</h2>

<ul>
 <li>{{ cssxref("opacity","CSS opacity") }}</li>
</ul>