<分区>
我希望我的第 3 行在外观上看起来像第 1 行。最初我试图给 rowspan="1.5",因为我尝试使用上面的代码它不起作用。当我尝试按照我在实现第 1 行时所遵循的程序进行操作时,会导致错位。
table {
border-collapse: collapse;
border: 0px;
}
td {
padding: 20px;
border: 1px solid black;
text-align: center;
}
thead tr th {
border: 0px;
}
<table border="1" width="100%">
<thead style="border: 0px solid black;">
<tr style="border=" 0px ">
<th style="border: 0px ">Row 1</th>
<th style="border: 0px ">Row 2</th>
<th style="border: 0px ">Row 3</th>
</tr>
</thead>
<tr>
<td rowspan="2 ">Row 1, cell 1</td>
<td rowspan="3 ">Row 1, cell 2</td>
<td >Row 1, cell 3</td>
</tr>
<tr>
<td>Row 2, cell 3</td>
</tr>
<tr>
<td rowspan="2 ">Row 3, cell 1</td>
<td rowspan=" ">Row 3, cell 3</td>
</tr>
<tr>
<td rowspan="3 ">Row 4, cell 2</td>
<td>Row 4, cell 3</td>
</tr>
<tr>
<td rowspan="2 ">Row 5, cell 1</td>
<td>Row 5, cell 3</td>
</tr>
<tr>
<td>Row 6, cell 3</td>
</tr>
</table>
最佳答案
对于 html 表格,rowspan 不能有 float 值。
根据 W3:
rowspan : This attribute specifies the number of rows spanned by the current cell. The default value of this attribute is one ("1"). The value zero ("0") means that the cell spans all rows from the current row to the last row of the table section (THEAD, TBODY, or TFOOT) in which the cell is defined
编辑:
当您使用 <td rowspan="x">
你必须删除 x
下一个对应的时间<tr>
这适合你吗?
<table>
<tr>
<td rowspan="2">r1 c1</td>
<td rowspan="3">r1 c2</td>
<td rowspan="2">r1 c3</td>
</tr>
<tr>
</tr>
<tr>
<td rowspan="2">r2 c1</td>
<td rowspan="2">r2 c3</td>
</tr>
<tr>
<td rowspan="3">r2 c2</td>
</tr>
<tr>
<td rowspan="2">r3 c1</td>
<td rowspan="2">r3 c3</td>
</tr>
</table>
关于html - 是否可以在 HTML 表格中将 rowspan 用作 1.5?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37145211/