如何在HTML工具提示中添加换行符?
我尝试在工具提示中使用<br/>和\n,如下所示:
<a href="#" title="Some long text <br/> Second line text \n Third line text">Hover me</a>
然而,这是无用的,我可以在工具提示中看到文字<br/>和\n。任何建议都会很有帮助。
如何在HTML工具提示中添加换行符?
我尝试在工具提示中使用<br/>和\n,如下所示:
<a href="#" title="Some long text <br/> Second line text \n Third line text">Hover me</a>
然而,这是无用的,我可以在工具提示中看到文字<br/>和\n。任何建议都会很有帮助。
当前回答
在文本之间给出\n。它适用于所有浏览器。
Example
img.tooltip= " Your Text : \n"
img.tooltip += " Your text \n";
这将为我工作,它在后面的代码中使用。
希望这对你有用
其他回答
这个css会帮助你。
.tooltip {
word-break: break-all;
}
or if you want in one line
.tooltip-inner {
max-width: 100%;
}
在文本之间给出\n。它适用于所有浏览器。
Example
img.tooltip= " Your Text : \n"
img.tooltip += " Your text \n";
这将为我工作,它在后面的代码中使用。
希望这对你有用
只需使用实体代码
用于标题属性中的换行符。
& # 013;结合样式留白:行前;为我工作。
只需添加data-html="true"
<a href="#" title="Some long text <br/> Second line text \n Third line text" data-html="true">Hover me</a>