title

<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>

产品规格

SpecificationStatusComment
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.RecommendationInitial definition

浏览器兼容性

FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support1.0(Yes)1.5 (1.8)9.08.03.0.4
Tooltip display??4.0 (2.0)???

FeatureAndroidEdgeFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support3.0(Yes)1.0 (1.8)No support(Yes)3.0.4
Tooltip display??4.0 (2.0)???