fij*_*ico 1 javascript svg d3.js
我想将 an 添加<abbr>到 SVG 的<text>标签,最终结果如<text><abbr title="Goals Per Match">GPM</abbr></text>. 我没有运气,所以我想知道这是否只是我的实现,或者 SVG 是否无法实现。
以下是我目前的实施方式:
svg.append("text")
.attr("id", "club_label")
.attr("x", width / 2 + 5 )
.attr("y", height )
.attr("fill", "white")
.style("text-anchor", "middle")
.append("abbr")
.attr("title", "Goals Per Match")
.text("GPM");
Run Code Online (Sandbox Code Playgroud)
<abbr>SVG 中没有元素。此外,SVG 不支持该title属性。它有一个<title>元素。
因此 SVG 中的等效内容如下:
text.abbr {
text-decoration: underline dotted;
}Run Code Online (Sandbox Code Playgroud)
<svg>
<text x="100" y="100" class="abbr">GPM<title>Goals Per Minute</title></text>
</svg>Run Code Online (Sandbox Code Playgroud)
请注意,dotted修饰符 fortext-decoration并不适用于所有浏览器。
| 归档时间: |
|
| 查看次数: |
137 次 |
| 最近记录: |