如何在 Firefox 中以多行显示 HTML“title”属性?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5193385/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 07:06:02  来源:igfitidea点击:

How to display HTML "title" attribute in multiple lines in Firefox?

htmltitle

提问by Misha Moroshko

Possible Duplicate:
How can I use a carriage return in a HTML tooltip ?

可能重复:
如何在 HTML 工具提示中使用回车?

I would like to display the "title" attribute tooltip in several lines, so it looks like this:

我想在几行中显示“title”属性工具提示,所以它看起来像这样:

Line 1
Line 2

I tried to do:

我试图做:

<div title="Line 1\nLine 2">Secret</div>

but it didn't work.

但它没有用。

Is that possible ?

那可能吗 ?

采纳答案by nollfem

As stated in How can I use a carriage return in a HTML tooltip?you can just do it like this:

如何在 HTML 工具提示中使用回车符中所述?你可以这样做:

<div title="Line 1  
Line 2">Secret</div>

Though it is said that it doesn't work with Firefox.

虽然据说它不适用于Firefox。

回答by anothershrubery

You can enter &#10;. In other words:

你可以输入&#10;。换句话说:

<div title="Line 1&#10;Line 2">Secret</div>

回答by AlanFoster

Either add new lines within the html itself

在 html 本身中添加新行

<div title="Line 1
Line 2">Secret</div>

Or make your own tooltip using javascript/css.

或者使用 javascript/css 制作您自己的工具提示。