开发者

Merging table column into single cell

I have a table that looks like this and this is its markup

______________________
_____|_______|________
_____|_______|________

<table>
<tbody>
<tr>
 <td>row 1 column 1</td>
 <td>row 1 column 2</td>
 <td>row 1 column 3</td>
</tr>
<tr>
 <td>row 2 column 1</td>
 <td>row 2 column 2</td>
 <td>row 2 column 3</td>
</tr>
</tbody>
</table>

How can I merge the entire second column into 1 cell so the table looks like this. Is it possible?

_____________________________
________|          |_________
__开发者_JAVA百科______|__________|_________


<table>
<tbody>
<tr>
 <td>row 1 column 1</td>
 <td rowspan="2">row 1 column 2</td>
 <td>row 1 column 3</td>
</tr>
<tr>
 <td>row 2 column 1</td>
 <td>row 2 column 3</td>
</tr>
</tbody>
</table>

This should work. Any element with rowspan="2" will span two rows. you can also put colspan="2" to span columns.


add a rowspan="2" to the second td of the first row and remove the second td from the second row.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜