由于table加上table-layout:fixed属性后,表格的宽度就被table的第一行固定了,也就是说后面无论怎么添加width属性都无效了,尤其是添加了colspan合并单元格后,后面的宽度都平均分配了。
解决办法:在table的第一行添加colgroup属性,预先把所有列的宽度固定。
例如:
<table width="93%" border="1" align="center" cellpadding="2" cellspacing="0" style ="table-layout:fixed;">
<colgroup>
<col width="20"></col>
<col width="58"></col>
<col width="58"></col>
<col width="40"></col>
</colgroup>
<tr>...</tr>
</table>
table添加table-layout:fixed属性和colspan后列宽调整无效问题
最新推荐文章于 2021-10-11 10:07:31 发布