结合 colspan 和 rowspan 的 HTML 表格

标签 html css html-table

我正在尝试制作一个具有以下布局的 html 表格:

+-------+---+
|       |   |
+-------+   +
|       |   |
+-----+-----+
|     |     |
+-----+-----+

我正在使用 colgroup 将整个表格分成 5% 的部分, 然后应用 colspanrowspan 将一些片段组合在一起。到目前为止,我还没有成功。我想知道是否有人能指出我正确的方向。需要一个表格来容纳电子邮件样式的可能性。

编辑:https://plnkr.co/edit/CHmiOuKpUlPsVJanLl7l?p=preview 按要求编码

最佳答案

要获得准确的 colspan 和 rowspan,您必须执行以下操作:

<table>
  <tr>
    <td colspan="3"></td>
    <td rowspan="2"></td>
  </tr>
  <tr>
    <td colspan="3"></td>
  </tr>
  <tr>
    <td colspan="2"></td>
    <td colspan="2"></td>
  </tr>
</table>

下面是运行中的代码:

https://jsfiddle.net/npjkrb55/1/

关于结合 colspan 和 rowspan 的 HTML 表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35133608/

相关文章:

HTML5 水平图像放置

html - 用 div 代替表格布局

javascript - 如何为具有相似值的动态表格行设置不同的背景颜色?

css - 用 watir 检查样式表

javascript - 滑动流体图像缩放

html - 不同行上的中心按钮和字形

html - 更改图像的边距值未生效

css - 文本 Sprite 样式

css - 为什么我的 div 不使用自动宽度?

html - 链接继承 div 大小