【发布时间】:2015-05-09 03:36:47
【问题描述】:
我有一个 SVG 图像,其中包含用作工具提示的
但是,当我在 HTML 文档中使用 SVG 时,通过 元素,鼠标悬停时不会显示工具提示。
是否可以让工具提示正确显示?
HTML 是
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>SVG in HTML title test</title>
</head>
<body>
<img src="test.svg" />
</body>
</html>
SVG 是
<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/SVG/DTD/svg10.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 100 100">
<title>SVG in HTML test</title>
<g>
<polygon stroke="black" stroke-width="1" fill="#0000ff" points="20,20 40,20 40,40 20,40" />
<title>rectangle</title>
</g>
<g>
<circle stroke="black" stroke-width="1" fill="#ff0000" cx="70" cy="70" r="10" />
<title>circle</title>
</g>
</svg>
【问题讨论】:
-
图像(
元素等)不是交互式的,因此它们中的标题元素不起作用。