我想使用<title>
标记向我的SVG路径添加一个多行工具提示。
它在Chrome中运行得很好,但是我尝试过的换行字符在Internet中得到了一个空间。
在Internet中,多行也可以在title=""
属性中工作。
下面的代码片段在svg和按钮上都有相同的MulilineTootl技巧。将在IE中运行。
<svg height="100" width="100">
<path d="M45 0 L15 80 L75 80 Z">
<title>test
test</title>
<!--<title>test
test</title>-->
<!--<title>test test</title>-->
<!--<title>test test</title>-->
</path>
</svg>
<div><button title="test
test">It works here</button><div>
发布于 2019-12-16 05:24:02
在IE浏览器中,使用<br>
标记在SVG元素中添加一个行中断;在Microsoft和Chrome中,使用

添加一个行中断。
守则如下:
<svg height="100" width="100">
<path d="M45 0 L15 80 L75 80 Z">
<title>test
<br>test</title>
<!--<title>test
test</title>-->
<!--<title>test test</title>-->
<!--<title>test test</title>-->
</path>
</svg>
<div><button title="test
test">It works here</button></div>
输出如下:
IE浏览器:
Chrome浏览器:
发布于 2021-11-29 16:00:55
在ReactJS中,这是为我工作的:
<svg><title>text1+{'\n'}text2</title></svg>
https://stackoverflow.com/questions/59325310
复制相似问题