如何覆盖表nowrap属性

Ami*_*ngh 3 html css

在IE8中它的工作正常.在Firefox中如果我从td文本中删除nowrap属性正在被正确包装但没有删除nowrap文本没有得到包装.

有没有办法在firefox中通过css覆盖nowrap属性.

<div style="width:100%;border:1px solid #eaeaea">
<table style="width:100%;word-wrap:break-word;table-layout:fixed" border="1" >
    <tr>
        <td>
            thisssssssssssssssssssssssssss
        </td>
        <td nowrap="" style="word-wrap:break-word;">
            22222222thisssssssssssssssssssssssssss22222222thisssssssssssssssssssssssssss22222222thisssssssssssssssssssssssssss
        </td>
    </tr>
</table>
</div>
Run Code Online (Sandbox Code Playgroud)

cla*_*uzy 14

table {
  table-layout:fixed;
  width:100%;
  word-wrap:break-word;
}

td {
 white-space: normal;
}
Run Code Online (Sandbox Code Playgroud)

white-space规则覆盖了no-wrap属性(你的问题),自动换行规则打破了不可破坏的字符串

  • 有关空白覆盖 nowrap 的信息对我非常有用,很好的答案,谢谢! (2认同)