该表格的布局指定如何表列的宽度被计算。可能的值是:
自动 auto -当列或单元格的宽度不显式地设置,列的宽度将是成比例的在组成列中单元格的内容量
固定fixed -当列或单元格的宽度不显式地设置,则列宽不受组成列的单元格中的内容量的影响。默认情况下
,表格布局设置为auto。 以下示例显示了auto和fixed之间的区别。html
<p>表格布局设置为<strong>自动 auto</strong> </ p>
<table class ="auto" >
<tr>
<td width ="10%"> 500.000.000.000.000 </td>
<td width ="90%"> 20.000 </td>
</tr>
</table>
<p>表格布局设置为<strong>固定 fixed</strong> </p>
<table class ="fixed" >
<tr>
<td width ="10%"> 500.000.000.000.000 </td>
<td width ="90%"> 20.000 </td>
</tr>
</table>
css
table {
border-collapse: separate;
width: 100%;
border: 1px solid gray;
}
td {
border: 1px solid gray;
}
table.auto {
table-layout: auto;
}
table.fixed {
table-layout: fixed;
}
