Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
滚动HTML嵌套表_Html_Html Table_Nested - Fatal编程技术网

滚动HTML嵌套表

滚动HTML嵌套表,html,html-table,nested,Html,Html Table,Nested,如果给定最大高度,如何使具有子/嵌套表的表可滚动?我不希望thead与它一起滚动。我真正想要的是一些有效的标记,我可以用它来包装我的s,或者一些其他的标记,它们的工作原理和下面的一样: <table> <thead> <tr> <th>Column1</th> <th>Column2</th> </tr>

如果给定最大高度,如何使具有子/嵌套表的表可滚动?我不希望thead与它一起滚动。我真正想要的是一些有效的标记,我可以用它来包装我的s,或者一些其他的标记,它们的工作原理和下面的一样:

    <table>
    <thead>
        <tr>
            <th>Column1</th>
            <th>Column2</th>
        </tr>
    </thead>
    <!-- Insert valid tag here to wrap <tbody>s -->
    <tbody>
        <tr>
            <td>Val1</td>
            <td>Val2</td>
        </tr>
        <tr class="sub-table">
            <td colspan="2">
                <table>
                    <thead>
                        <tr>
                            <th>Sub Column1</th>
                            <th>Sub Column2</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>Sub Val1</td>
                            <td>Sub Val2</td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
    </tbody>
    <tbody>
        <tr>
            <td>Val1</td>
            <td>Val2</td>
        </tr>
        <tr class="sub-table">
            <td colspan="2">
                <table>
                    <thead>
                        <tr>
                            <th>Sub Column1</th>
                            <th>Sub Column2</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>Sub Val1</td>
                            <td>Sub Val2</td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
    </tbody>
    <!-- Insert valid close tag here -->
</table>

专栏1
专栏2
瓦尔1
瓦尔2
第1分栏
第2分栏
次级价值1
次级价值2
瓦尔1
瓦尔2
第1分栏
第2分栏
次级价值1
次级价值2

如果我正确理解了您的问题,可以尝试以下方法:


您需要将TBODY元素显示为“block”或“inline block”,以便溢出处理它,如我发布的CSS示例所示。

您希望嵌套表的TBODY滚动,但嵌套表的THEAD保持固定,还是应该仅主表的THEAD保持固定?