...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
table
{
table-layout:fixed;
}
td
{
text-overflow:ellipsis;
white-space:nowrap;
overflow:hidden;
}
</style>
</head>
<body>
<table width="100%" border="1" class="xTable">
<tr>
<td width="100">col_1</td>
<td>col_2</td>
<td width="120">col_3</td>
<td width="100">col_4</td>
</tr>
<tr>
<td>abcdefg</td>
<td>a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z</td>
<td>abcdefg</td>
<td>abcdefg</td>
</tr>
</table>
</body>
</html>
未添加截断字符串样式前:
添加截断字符串样式后:
(转自:http://0123.blog.163.com/blog/static/478831200910275422865/)
- 大小: 18.1 KB
- 大小: 10.5 KB