我有一个
table
,表格布局已修复。表中有 2 列。
如果我为第一行设置
colspan=2
,那么对于其余行,它显示相同的宽度。 (它没有采用我指定的宽度。)
小提琴附这里
<table style='table-layout:fixed' border="1" width="100%">
<thead>
<tr>
<th colspan='2'>10000</th>
</tr>
<tr>
<th width="5%">1066fdg</th>
<th width="95%">10</th>
</tr>
</thead>
</table>
有没有办法为剩余的行设置指定的列宽?
这是因为固定表格布局是由第一行或列定义驱动的 - 试试这个
<table style='table-layout:fixed' border="1" width="100%">
<col width="5%" />
<col width="95%" />
<thead>
<tr>
<th colspan='2'>10000</th>
</tr>
<tr>
<th>1066fdg</th>
<th>10</th>
</tr>
</thead>
</table>
您在
th
上设置了宽度,为什么不在样式表中设置一个类来为 th
和 tr
行提供所需的宽度?
试试这个
<table style='table-layout:fixed' border="1" >
<col width="5%" />
<col width="95%" />
<thead>
<tr>
<th colspan='2'>10000</th>
</tr>
<tr>
<th>1066fdg</th>
<th>10</th>
</tr>
<tr><th> </th><th> </th></tr>
</thead>
</table>