html - Rowspan 无法正常工作,我该怎么做才能实现这一目标?

标签 html css html-table

出于某种原因,我无法让该表接受行跨度。

我没试过多少。

<table style="border: 3px solid black; width:95%">
            <caption>This is a caption, looks a lot like a 
title</caption>
            <colspan>
                <col style="background-color:aquamarine">
                <col style="background-color:crimson">
                <col style="background-color:aquamarine">
            </colspan>
            <thead>
                <tr>
                    <th colspan="2">This is a colspan.</th>
                    <th rowspan="3">rowspan</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>Test1</td>
                    <td>Test2</td>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <td>Test3</td>
                    <td>Test4</td>
                </tr>
            </tfoot>
        </table>

我希望 rowspan="3"正常工作。

最佳答案

如果我对问题的理解正确,您希望包含标题的行具有 rowspan。

<table style="border: 3px solid black; width:95%">
            <caption>This is a caption, looks a lot like a 
title</caption>
            <colspan>
                <col style="background-color:aquamarine">
                <col style="background-color:crimson">
                <col style="background-color:aquamarine">
            </colspan>
            <tbody>
                <tr>
                    <th colspan="2">This is a colspan.</th>
                    <th rowspan="3">rowspan</th>
                </tr>           
                <tr>
                    <td>Test1</td>
                    <td>Test2</td>
                </tr>
                <tr>
                    <td>Test3</td>
                    <td>Test4</td>
                </tr>
            </tbody>
           
        </table>

这是您所期望的吗?

关于html - Rowspan 无法正常工作,我该怎么做才能实现这一目标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57175653/

相关文章:

javascript - 在reveal.js中嵌入本地html文件

javascript - Vue.js - 如何在点击时切换图标类

html - overflow hidden 文本后面的文本

css - Bootstrap 输入按钮未与其他字段对齐

javascript - Jquery 隐藏不与 Ruby/Rails 一起工作

javascript - jQuery - 添加另一行

html - 几乎相同页面之间的 CSS 过渡

html - superfish 菜单缩进问题

jquery - 如何删除表格第一行的点击事件

php - Mysql 数据到样式化的 HTML 表