在HTML中将表单元格拆分为两列 [英] Splitting a table cell into two columns in HTML

查看:1864
本文介绍了在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">&nbsp;</th>
    <td>&nbsp;</td>
    <td>Split this one into two columns</td>
  </tr>
</table>

我想拆分包含 em>划分为两个单元格/列。我该如何解决这个问题?

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 /

colspan =2添加到第三个 ; th> ,然后在第二行中有4个< td>

Add 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">&nbsp;</th>
    <td>&nbsp;</td>
    <!-- The following two cells will appear under the same header -->
    <td>Col 1</td>
    <td>Col 2</td>
  </tr>
</table>

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

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