【发布时间】:2016-08-19 17:15:02
【问题描述】:
现代浏览器是否可以让< use > 元素在鼠标悬停时显示矩形工具提示?
<svg id="schematic" version="1.2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<symbol id="pnp-transistor">
<image xlink:href="transistor.png" height="32px" width="32px" />
<rect y="0" x="0" height="6px" width="32px">
<title>collector</title>
<hint>collector</hint>
</rect>
<rect y="27" x="0" height="6px" width="32px">
<title>emitter</title>
<hint>emitter</hint>
</rect>
<rect y="0" x="0" height="32px" width="6px">
<title>base</title>
<hint>base</hint>
</rect>
</symbol>
<use xlink:href="#pnp-transistor"></use>
</svg>
【问题讨论】:
-
你的意思是像创建一个名为
-
不,SVG使用元素;见上文。
-
只能通过一些自定义的 javascript 将标题复制到作为子元素使用。
标签: javascript css svg tooltip