首页 > 解决方案 > 为什么 Html 中的 + 符号永远不起作用?

问题描述

我正在尝试在一个表中同时创建行跨度和列跨度。但是,我想我需要使用我的 + 号和我的范围 html 变量。我相信范围 html 变量是强制放下或强制放置您自己的表格的右侧。

<!DOCTYPE html>

<html>
    <body>
        <table border= "1">
            
            <tr>
                <th>C1,R1,headings</th>
                <th>C2,R1,headings</th>
                <th>C3,R1,headings</th>
                <th>C4,R1,headings</th>
            </tr>

            <tr>
                <td rowspan= "2" + colspan="2">
                    stretching from C1,R2 into
                    the C2,R3
                </td>
            </tr>

            <tr>
                <td scope= "row" + scope= "col">
                    C3,R2,textAfterwards
                </td>
                <td scope= "row" + scope= "col">
                    C4,R2,textAfterwards
                </td>
            </tr>

            <tr>
                <td scope= "row" + scope= "col">
                    C3,R3,textAfterwards
                </td>
                <td scope= "row" + scope= "col">
                    C4,R3,textAfterwards
                </td>
            </tr>
            
        </table>
    </body>
</html>

标签: html

解决方案


你可以同时拥有rowspan这样colspan的:

<td rowspan="2" colspan="2">

令人困惑的是,您似乎认为只有在使用 + 号时才会应用它们,但这是错误的。


推荐阅读