【问题标题】:html colspan rowspan [closed]html colspan 行跨度 [关闭]
【发布时间】:2013-03-12 09:09:03
【问题描述】:

我使用 html 表、colspan 和 rowspan。我想创建这样的表:

._______________________。
| | | |
|______ |________|_______|
|___|___| |___|___|
| |_______| |
|_______|___|___|_______| 

但是找不到解决办法!请帮忙!

【问题讨论】:

  • 我尝试用 colspan2 rowspan2 cell cell , cell with colpan2rowspan2, cell cell cell with colspan2 rowspan2 ,cell cell, cell with colspan2 rowspan2 创建3个单元格

标签: html html-table


【解决方案1】:

您需要使用colspanrowspan 属性,检查我的示例以了解它是如何完成的。当您的 <td> 具有 colspanrowspan 时,它会被展开,并且本应位于该位置的下一个 <td> 将被跳过(请参阅最后一个 <tr> 只有 2 个 <td>s)。

jsFiddle

<table>
    <tr>
        <td colspan="6">&nbsp;</td>
    </tr>
    <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td colspan="2" rowspan="2">&nbsp;<br />&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td colspan="2" rowspan="2">&nbsp;<br />&nbsp;</td>
        <td colspan="2" rowspan="2">&nbsp;<br />&nbsp;</td>
    </tr>
    <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
    </tr>
</table>

【讨论】:

  • 是的!我必须使用 /br 标签:)
  • 谢谢!是工作!我必须使用 /br,这就是为什么我的表不工作!
  • 很高兴听到 :) 不要忘记通过打勾来接受答案。
【解决方案2】:

制作一个有四行的表格,并使用这些设置在行中的单元格:

colspan 6

none
none
colspan 2, rowspan 2
none
none

colspan 2, rowspan 2
colspan 2, rowspan 2

none
none

【讨论】:

    【解决方案3】:

    应该这样做:

    <table>
        <tr>
            <td colspan=6>&nbsp;<br>&nbsp;</td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td colspan=2 rowspan=2>&nbsp;<br>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td colspan=2 rowspan=2>&nbsp;<br>&nbsp;</td>
            <td colspan=2 rowspan=2>&nbsp;<br>&nbsp;</td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
    </table>
    

    Fiddle

    【讨论】:

      猜你喜欢
      • 2020-11-15
      • 1970-01-01
      • 1970-01-01
      • 2015-07-04
      • 2018-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多