如何防止在表的列中自动换行(不是单个单元格)?


当前回答

只需添加

style="white-space:nowrap;"

例子:

<table class="blueTable" style="white-space:nowrap;">
   <tr>
      <td>My name is good</td>
    </tr>
 </table>

其他回答

为了完整起见:

#table_id td:nth-child(2)  {white-space: nowrap;}

用于对table_id表的2列应用样式。

所有主流浏览器都支持这一点,IE从IE9开始支持这一点。

要将它应用到整个表,你可以将它放在table标签中:

<表风格= "空白:nowrap;}" >

你可以使用CSS样式的空白:

white-space: nowrap;

只需添加

style="white-space:nowrap;"

例子:

<table class="blueTable" style="white-space:nowrap;">
   <tr>
      <td>My name is good</td>
    </tr>
 </table>

使用nowrap样式:

<td style="white-space:nowrap;">...</td>

CSS !