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

前端之家收集整理的这篇文章主要介绍了html – CSS:white-space:nowrap似乎在IE中不起作用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
这是下面的代码的jsfiddle. http://jsfiddle.net/ux4DD/2/.我想要的是Harry Pham在一行中的名字,所以我使宽度非常小,做白色空间:nowrap.它在Firefox上工作,但不是IE.请帮助

以下是答案.请看JSFIDDLE以了解它如何看待

<html>
<head>
   <style type="text/css">
       .linkColor{
           white-space: nowrap;
       }
   </style>
</head>
<body>
<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;">
                     <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>
</body>
</html>

解决方法

对于IE 6和7,您需要用< span>标签,并给它一个空白的空间.由于您已经拥有< span>标签包裹在您的文字上,您有一个类,只需将空格属性添加到您的< span> class .linkColor.
.linkColor{
    white-space:nowrap;
}

检查工作示例在http://jsfiddle.net/ux4DD/1/

原文链接:https://www.f2er.com/html/230945.html

猜你在找的HTML相关文章