这是下面代码的jsfiddle
。 http://jsfiddle.net/ux4DD/ .我想要的是 Harry Pham
这个名字在一行中,所以我将宽度设置得非常小,并执行 white-space:nowrap
。它适用于 Firefox,但不适用于 IE。请帮忙
<table cellpadding="0" cellspacing="0" style="width: 450px;">
<tr>
<td>
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td style="width:20px;border-top:1px solid gray;white-space: nowrap;"><span class="linkColor">Harry Pham</span>
</td>
<td style="height:15px;background:url('images/line.png') no-repeat;width:28px;" width="35px"></td>
<td style="border-bottom:1px solid gray;" width="auto"></td>
</tr>
</table>
</td>
</tr>
</table>
最佳答案
对于 IE 6 和 7,您需要使用 <span>
将文本换行标记并给它一个 white-space
属性(property)。因为你已经有了一个 <span>
标签包裹着你的文本,你有一个类,只需添加 white-space
属性(property)给你<span>
类 .linkColor
.
.linkColor{
white-space:nowrap;
}
在 http://jsfiddle.net/ux4DD/1/ 查看工作示例
关于html - CSS: white-space: nowrap 似乎在 IE 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5280521/