html - CSS: white-space: nowrap 似乎在 IE 中不起作用

标签 html css

这是下面代码的jsfiddlehttp://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/

相关文章:

html - 在部门菜单的悬停上闪烁我想创建下拉菜单

php - phpexcel生成报告时出错

javascript - js渲染循环一旦满足条件就会中断

javascript - 用 % 宽度和高度控制图像的纵横比

html - 如何更改 Bootstrap 中表单控件弹出窗口中必填字段的默认消息?

html - Safari 中的边框不是像素完美的

php - 链接到本地​​硬盘上的文件

html - 垂直居中而不使用表格单元格且高度未知

CSS 样式无法与 Sencha touch 一起正常工作

html - 在 IE8 中水平居中绝对 DIV