将表格列合并为单个单元格 [英] Merging table column into single cell

查看:29
本文介绍了将表格列合并为单个单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个看起来像这样的表格,这是它的标记

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>

如何将整个第二列合并为 1 个单元格,使表格看起来像这样.可能吗?

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

_____________________________
________|          |_________
________|__________|_________

推荐答案

<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>

这应该有效.任何具有 rowspan="2" 的元素都将跨越两行.您还可以将 colspan="2" 用于跨列.

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

这篇关于将表格列合并为单个单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆