如何在 HTML 表格中使用 colspan 和 rowspan? [英] How do you use colspan and rowspan in HTML tables?

查看:22
本文介绍了如何在 HTML 表格中使用 colspan 和 rowspan?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道如何合并 HTML 表格中的行和列.

I don't know how to merge rows and columns inside HTML tables.

你能帮我用 HTML 制作这样的表格吗?

Can you please help me with making such a table in HTML?

推荐答案

我建议:

table {
    empty-cells: show;
    border: 1px solid #000;
}

table td,
table th {
    min-width: 2em;
    min-height: 2em;
    border: 1px solid #000;
}

<table>
    <thead>
        <tr>
            <th rowspan="2"></th>
            <th colspan="4">&nbsp;</th>
        </tr>
        <tr>
            <th>I</th>
            <th>II</th>
            <th>III</th>
            <th>IIII</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td></td>
            <td>1</td>
            <td>2</td>
            <td>3</td>
            <td>4</td>
         </tr>
    </tbody>
</table>

参考文献:

  • td element.
  • th element.
  • tbody element.
  • thead element.
  • table element.

这篇关于如何在 HTML 表格中使用 colspan 和 rowspan?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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