将表格单元格拆分为 HTML 中的两列 [英] Splitting a table cell into two columns in HTML
问题描述
我有下表:
<table border="1">
<tr>
<th scope="col">Header</th>
<th scope="col">Header</th>
<th scope="col">Header</th>
</tr>
<tr>
<th scope="row"> </th>
<td> </td>
<td>Split this one into two columns</td>
</tr>
</table>
并且我希望将包含将此一分为二列"的单元格拆分为两个单元格/列.我该怎么做?
And I wish to split the cell which contains "Split this one into two columns" into two cells/columns. How do I go about this?
推荐答案
像这样 http://jsfiddle.net/8ha9e/1/
将 Add 这篇关于将表格单元格拆分为 HTML 中的两列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!colspan="2"
添加到第三个 然后在第二个 中有 4 个 行.
colspan="2"
to the 3rd <th>
and then have 4 <td>
's in your second row.<table border="1">
<tr>
<th scope="col">Header</th>
<th scope="col">Header</th>
<th scope="col" colspan="2">Header</th>
</tr>
<tr>
<th scope="row"> </th>
<td> </td>
<!-- The following two cells will appear under the same header -->
<td>Col 1</td>
<td>Col 2</td>
</tr>
</table>
登录
关闭