You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用TailwindCSS 3.4.1时,fieldset包裹表格后横向滚动失效的问题咨询

使用TailwindCSS 3.4.1时,fieldset包裹表格后横向滚动失效的问题咨询

大家好,我最近在用TailwindCSS 3.4.1开发时碰到个头疼的问题,想请教下各位前辈。

最开始我做了个表格,给包裹它的div加了overflow-x-auto类,这样表格内容超出容器宽度时能正常横向滚动,代码大概是这样的:

<div class="my-0 mx-2 p-0 overflow-x-auto">
    <table class="editor_listing_table mb-4">
        <thead class="editor_listing_table_header">
        <tr>
            <!-- 表头内容 -->
        </tr>
        </thead>
        <!-- 表格主体内容 -->
    </table>
</div>

本来一切都正常,但当我用fieldset把这个div和整个表格都包裹起来后,横向滚动突然就失效了!现在的代码结构变成了这样:

<fieldset class="p-1 m-1 mb-6 bordered">
    <legend class="bordered">
        Your active tasks
    </legend>
    <div class="my-0 mx-2 p-0 overflow-x-auto d1">
        <table class="editor_listing_table mb-4">
            <thead class="editor_listing_table_header">
            <tr>
                <!-- 表头内容 -->
            </tr>
            </thead>
            <!-- 表格主体内容 -->
        </table>
    </div>
</fieldset>

有没有大佬知道这是啥原因呀?为啥加了fieldset之后,overflow-x-auto的横向滚动效果就没了呢?麻烦帮忙看看,谢谢啦!

备注:内容来源于stack exchange,提问作者mstdmstd

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.17 08:47:59