--- title: tspan slug: Web/SVG/Element/tspan tags: - SVG - SVG文本子元素 - 元素 - 参考 - 需要兼容性表 translation_of: Web/SVG/Element/tspan --- <div>{{SVGRef}}</div> <p>在 {{SVGElement("text")}}元素中,利用内含的<code>tspan</code>元素,可以调整文本和字体的属性以及当前文本的位置、绝对或相对坐标值。</p> <h2 id="用法">用法</h2> <p>{{svginfo}}</p> <h2 id="示例">示例</h2> <p>» <a href="https://developer.mozilla.org/files/3338/tspan.svg" title="https://developer.mozilla.org/files/3338/tspan.svg">tspan.svg</a></p> <h2 id="属性">属性</h2> <h3 id="全局属性">全局属性</h3> <ul> <li><a href="/en/SVG/Attribute#ConditionalProccessing" title="en/SVG/Attribute#ConditionalProccessing">条件处理属性</a> »</li> <li><a href="/en/SVG/Attribute#Core" title="en/SVG/Attribute#Core">核心属性</a> »</li> <li><a href="/en/SVG/Attribute#GraphicalEvent" title="en/SVG/Attribute#GraphicalEvent">图形事件属性</a> »</li> <li><a href="/en/SVG/Attribute#Presentation" title="en/SVG/Attribute#Presentation">外观属性</a> »</li> <li>{{ SVGAttr("class") }}</li> <li>{{ SVGAttr("style") }}</li> <li>{{ SVGAttr("externalResourcesRequired") }}</li> </ul> <h3 id="专有属性">专有属性</h3> <ul> <li>{{ SVGAttr("x") }}</li> <li>{{ SVGAttr("y") }}</li> <li>{{ SVGAttr("dx") }}</li> <li>{{ SVGAttr("dy") }}</li> <li>{{ SVGAttr("rotate") }}</li> <li>{{ SVGAttr("textLength") }}</li> <li>{{ SVGAttr("lengthAdjust") }}</li> </ul> <h2 id="DOM_接口">DOM 接口</h2> <p>该元素实现了<code><a href="/en/DOM/SVGTSpanElement" title="en/DOM/SVGTSpanElement">SVGTSpanElement</a></code>接口。</p> <h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{ CompatibilityTable() }}</p> <div id="compat-desktop"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Chrome</th> <th>Firefox (Gecko)</th> <th>IE</th> <th>Opera</th> <th>Safari</th> </tr> <tr> <td>Basic support</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>Feature</th> <th>Android</th> <th>Firefox Mobile (Gecko)</th> <th>IE Phone</th> <th>Opera Mobile</th> <th>Safari Mobile</th> </tr> <tr> <td>Basic support</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>该表格基于<a href="/en/SVG/Compatibility_sources" title="en/SVG/Compatibility sources">这些资源</a>。</p> <p>[1] 多种外观属性不起作用。rotate属性在Gecko2.0中实现。{{geckoRelease("2.0")}}.</p> <h2 id="参见">参见</h2> <ul> <li>{{ SVGElement("text") }}</li> </ul>