表头底部的线来自Layui自动注入的内联样式border-bottom:1px solid #e6e6e6 !important,需用!important覆盖.layui-table-thead th、.layui-table-fixed-l/r .layui-table-thead th和.layui-table-header三处,且done回调中用$(this.elem).next()动态清除更稳妥。

为什么表头底部总有一条线?
这条线不是 border-bottom 简单加在 th 上,而是来自 Layui 渲染时自动注入的内联样式:style="border-bottom: 1px solid #e6e6e6 !important"。它直接写死在 .layui-table-thead th 元素上,普通 CSS 选择器权重不够,不加 !important 基本无效。
最稳的 CSS 覆盖写法
必须同时命中三处,否则在固定列、皮肤主题或重载后会复现:
.layui-table-thead th { border-bottom: none !important; }.layui-table-fixed-l .layui-table-thead th, .layui-table-fixed-r .layui-table-thead th { border-bottom: none !important; }-
.layui-table-header { border-bottom: none !important; }(这是表头容器本身那条)
注意:别漏掉 .layui-table-header —— 它是包裹整个表头的外层 div,某些皮肤(如 skin: 'line')会在这里额外加边框。
done 回调里补一刀更保险
表格异步加载或 table.reload() 后,CSS 可能已加载但 DOM 尚未就位。此时纯样式表容易“闪现”一下再消失。在 done 回调里强制清一次:
done: function(res, curr, count) {
$(this.elem).next().find('.layui-table-thead th').css('border-bottom', 'none');
$(this.elem).next().find('.layui-table-header').css('border-bottom', 'none');
}
用 $(this.elem).next() 是关键:Layui 把表头 DOM 插在 table 元素之后的兄弟节点,不是内部子节点。
皮肤主题干扰怎么处理
如果你用了 skin: 'line' 或自定义主题,它们可能在 .layui-table 或 .layui-table-body 上叠加边框。检查并补充:
.layui-table.skin-line { border-bottom: none !important; }-
.layui-table-body { border-top: none !important; }(防止 body 顶边和 thead 底边形成双线)
真正容易被忽略的是:这条线在 IE 或低版本 Chrome 下可能由伪元素 ::after 绘制,顺手加一句 .layui-table-thead::after { display: none !important; } 更彻底。


















