我制作了一个 html 表格,完成后我注意到我犯了一个错误,一行有 5 列,而其他所有列有 3 列。是否可以通过使 2 列只有半列宽或仅使用 html 自动调整它?我不想使用 colspan,因为它是一个非常大的表。
<table border="1">
<tr>
<td>something</td>
</tr>
<tr>
<td>these should be</td>
<td>as long as the others</td>
</tr>
<tr>
<td> something </td>
</tr>
</table>
最佳答案
嵌套表格
如果您绝对不想使用colspan
,您可以尝试嵌套一个表格:
<table border="1">
<tr>
<td>something</td>
</tr>
<tr>
<td>
<table border="1">
<tr>
<td>these should be</td>
<td>as long as the others</td>
</tr>
</table>
</td>
</tr>
<tr>
<td> something </td>
</tr>
</table>
关于HTML 表格半列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26911284/