1

我有一个工具提示,应用了这样的标题属性:

<img src="myGif.gif" border="0"  class="tooltip" alt="Help"
title="This is a world of mad people who don't believe in what they are doing and as such they are extremely risky and will lead to the destruction of the society as we call it"/>

问题是,我希望内容出现在一行中,但它在 IE 和 Mozilla 中被分解了。

在 ie(7 和 8) 中,内容呈现为三行,如下所示:

This is a world of mad people who don't believe in what they are doing
and as such they are extremely risky and will lead to the 
destruction of the society as we call it

在 Mozilla 中,它呈现如下:

This is a world of mad people who don't believe in what they are doing and as such they are
extremely risky and will lead to the destruction of the society as we call it

但我希望内容在一行中呈现。

所以我需要使用 javascript 或 CSS 或 jquery 来渲染它。但是,直到现在我都无法这样做。

4

1 回答 1

0

您应该在tooltip.css定义工具提示样式的某处包含类似文件的内容。所以将默认的工具提示 css 设置为: white-space:nowrap;. 这将强制所有内容集中在一行上,但可能会导致文本超出元素,因此您可能还必须调整工具提示的宽度(如果您网站上的其他地方有工具提示,这是一种特殊情况,更聪明的解决方案是为这种情况创建自定义 css,并使用它并将默认 css 保留为所有其他情况)。

于 2013-05-01T16:16:05.710 回答