title
SVG图形中的每个容器元素或图形元素都可以提供<title>
包含说明字符串的元素,其中的描述仅为纯文本。当前SVG文档片段在可视媒体上呈现为SVG时,<title>
元素不会被渲染为图形的一部分。但是,某些用户代理可能会将该<title>
元素显示为工具提示。交替的演示是可能的,包括视觉和听觉,它们显示<title>
元素,但不显示path
元素或其他图形元素。该<title>
元素通常会提高SVG文件的可访问性。
通常,<title>
元素应该是其父项的第一个子元素。请注意,那些<title>
用来显示工具提示的实现通常只会在<title>
父级的第一个子元素的情况下才会这样做。
用法上下文
分类 | 描述性元素 |
---|---|
允许的内容 | 任何元素或字符数据 |
属性
全局属性
- Core attributes
class
style
具体属性
没有具体的属性
DOM接口
这个元素实现了SVGTitleElement
接口。
例子
<svg width="500" height="300" xmlns="http://www.w3.org/2000/svg">
<g>
<title>SVG Title Demo example</title>
<rect x="10" y="10" width="200" height="50"
style="fill:none; stroke:blue; stroke-width:1px"/>
</g>
</svg>
产品规格
Specification | Status | Comment |
---|---|---|
Scalable Vector Graphics (SVG) 2The definition of '<title>' in that specification. | Candidate Recommendation | |
Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of '<title>' in that specification. | Recommendation | Initial definition |
浏览器兼容性
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 1.0 | (Yes) | 1.5 (1.8) | 9.0 | 8.0 | 3.0.4 |
Tooltip display | ? | ? | 4.0 (2.0) | ? | ? | ? |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | 3.0 | (Yes) | 1.0 (1.8) | No support | (Yes) | 3.0.4 |
Tooltip display | ? | ? | 4.0 (2.0) | ? | ? | ? |
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com