javascript 使td内容不换行不撑开

2019-12-24,

复制代码 代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<style type="text/css">
table {width:200px;table-layout:fixed;}
td {white-space:nowrap;overflow:hidden;word-break:keep-all;}
</style>
<table border="1">
<tr>
<td style="width:50px;">测试测试测试测试测试测试测试测试测试测试</td>
<td>测试测试测试测试测试测试测试测试测试测试测试测试</td>
</tr>
<tr>
<td>测试测试测试测试测试测试测试测试测试测试测试</td>
<td>测试测试测试测试测试测试测试测试测试测试测试</td>
</tr>
</table>
</body>
</html>

您可能感兴趣的文章:

  • div css nowrap无换行
  • html小技巧之td,div标签里内容不换行

《javascript 使td内容不换行不撑开.doc》

下载本文的Word格式文档,以方便收藏与打印。