开发者

Merging table column into single cell

开发者 https://www.devze.com 2023-02-08 11:20 出处:网络
I have a table that looks like this and this is its markup ______________________ _____|_______|________

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

精彩评论

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