blob: 0505aa623ce28166a1714eba88d81b34f7154a45 (
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
---
title: symbol
slug: Web/SVG/Element/symbol
tags:
- Container SVG
- Elemento
- Referencia
- SVG
translation_of: Web/SVG/Element/symbol
---
<div>{{SVGRef}}</div>
<p>O elemento <code>symbol</code> é usado para definir um template que pode ser inicializado por um elemento {{ SVGElement("use") }}. A utilização de elementos <code>symbol</code> para gráficos que são usados várias vezes no mesmo documento acrescenta estrutura e semântica. Documentos que são ricos em estrutura podem ser renderizados graficamente, através da fala, ou do braille, e assim promover a acessibilidade. Note que o elemento <code>symbol</code> em si não é renderizado. Somente instâncias de um elemento <code>symbol</code> (por exemplo, uma referência à um elemento <code>symbol</code> feita por um elemento {{ SVGElement("use") }}) são renderizadas.</p>
<h2 id="Contexto_de_uso">Contexto de uso</h2>
<p>{{svginfo}}</p>
<h2 id="Exemplo">Exemplo</h2>
<pre class="brush: html"><svg>
<!-- definição de symbol NUNCA é renderizada -->
<symbol id="sym01" viewBox="0 0 150 110">
<circle cx="50" cy="50" r="40" stroke-width="8" stroke="red" fill="red"/>
<circle cx="90" cy="60" r="40" stroke-width="8" stroke="green" fill="white"/>
</symbol>
<!-- renderização por elementos "use" -->
<use xlink:href="#sym01"
x="0" y="0" width="100" height="50"/>
<use xlink:href="#sym01"
x="0" y="50" width="75" height="38"/>
<use xlink:href="#sym01"
x="0" y="100" width="50" height="25"/>
</svg>
</pre>
<p>{{EmbedLiveSample("Exemplo",150,110)}}</p>
<h2 id="Atributos">Atributos</h2>
<h3 id="Atributos_globais">Atributos globais</h3>
<ul>
<li><a href="/pt-BR/SVG/Attribute#Core" title="pt-BR/SVG/Attribute#Core">Atributos principais</a> »</li>
<li><a href="/pt-BR/SVG/Attribute#GraphicalEvent" title="pt-BR/SVG/Attribute#GraphicalEvent">Atributos de eventos gráficos</a> »</li>
<li><a href="/pt-BR/SVG/Attribute#Presentation" title="pt-BR/SVG/Attribute#Presentation">Atributos de apresentação</a> »</li>
<li>{{ SVGAttr("class") }}</li>
<li>{{ SVGAttr("style") }}</li>
<li>{{ SVGAttr("externalResourcesRequired") }}</li>
</ul>
<h3 id="Atributos_específicos">Atributos específicos</h3>
<ul>
<li>{{ SVGAttr("preserveAspectRatio") }}</li>
<li>{{ SVGAttr("viewBox") }}</li>
</ul>
<h2 id="Interface_DOM">Interface DOM</h2>
<p>Esse elemento implementa a interface do <code><a href="/pt-BR/DOM/SVGSymbolElement" title="pt-BR/DOM/SVGSymbolElement">SVGSymbolElement</a></code>.</p>
<h2 id="Compatibilidade">Compatibilidade</h2>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop">
<table class="compat-table">
<tbody>
<tr>
<th scope="col">Recurso</th>
<th scope="col">Chrome</th>
<th scope="col">Firefox (Gecko)</th>
<th scope="col">Internet Explorer</th>
<th scope="col">Opera</th>
<th scope="col">Safari</th>
</tr>
<tr>
<td>Suporte básico</td>
<td>1.0</td>
<td>{{ CompatGeckoDesktop('1.8') }}</td>
<td>{{ CompatIE('9.0') }}</td>
<td>{{ CompatOpera('9.0') }}</td>
<td>{{ CompatSafari('3.0.4') }}</td>
</tr>
</tbody>
</table>
</div>
<div id="compat-mobile">
<table class="compat-table">
<tbody>
<tr>
<th>Recurso</th>
<th>Android</th>
<th>Firefox Mobile (Gecko)</th>
<th>IE Phone</th>
<th>Opera Mobile</th>
<th>Safari Mobile</th>
</tr>
<tr>
<td>Suporte básico</td>
<td>{{ CompatAndroid('3.0') }}</td>
<td>{{ CompatGeckoMobile('1.8') }}</td>
<td>{{ CompatNo() }}</td>
<td>{{ CompatVersionUnknown() }}</td>
<td>{{ CompatSafari('3.0.4') }}</td>
</tr>
</tbody>
</table>
</div>
<p>Essa tabela é baseada <a href="/en/SVG/Compatibility_sources" title="en/SVG/Compatibility sources">nessas fontes</a>.</p>
<h2 id="Veja_também">Veja também</h2>
<ul>
<li>{{ SVGElement("marker") }}</li>
<li>{{ SVGElement("pattern") }}</li>
</ul>
|