Rowspan无法正常工作,该怎么办?

时间:2019-07-24 05:12:40

标签: 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”正常工作。

1 个答案:

答案 0 :(得分:0)

如果我对问题的理解正确,那么您希望包含标题的行的行跨度。

<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>

这是您的期望吗?