省略超出列部分,设计到表格的列计算规则:table-layout,其值包括:
automatic: 为默认值,列的宽度由单元格里面的内容来设定。
fixed: 列宽度由表格宽度和列宽度来设定。
inherit: 列宽度从父元素继承而来。
border-spacing:设置单元格之前的间距,参数分别横向和纵向,若只有一个参数则两个方向相等。
border-collapse:设置单元格边框属性,可能的值有:separate(分开)collapse(合并)。
<html >
<head>
<meta charset=" utf-8">
<style type="text/css">
table
{
width:400px;
border-collapse: collapse;
border-spacing:5px 20px;
}
.one
{
margin:20px;
table-layout: automatic;
}
.tow
{
margin:20px;
table-layout: automatic;
}
.three
{
margin:20px;
table-layout: fixed;
}
.three td{
margin:20px;
overflow: hidden;
white-space:nowrap;
text-overflow:ellipsis;
}
</style>
</head>
<body>
<table class="one" border="1" >
<tr>
<th width="20%">qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq</td><!-- //汉字没有效果。 -->
<th width="40%">10000000</td>
<th width="40%">100</td>
</tr>
</table>
<table class="tow" border="1" >
<caption>测试表格</caption>
<tr>
<td width="20%">你你你你你你你你你你你您你你你你你你你你你</td>
<td width="40%">100000000000000000000000</td>
<td width="40%">100</td>
</tr>
</table>
<table width="200" border="1" class="three">
<tr>
<td width="20%">哈哈哈哈哈</td>
<td width="20%">你你你你你你你你inin你你你您你你你你你你你你你</td>
<td width="30%">100000000000000000000000</td>
<td width="30%">100</td>
</tr>
<tr>
<td colspan="3" rowspan="3"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>