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

Antd Table组件如何移除表头列之间的分隔线?

移除Ant Design Table表头列分隔线的方法

要去掉Antd Table表头各列之间的竖分隔线,最直接的方式是通过CSS样式覆盖,以下是几种常用方案:

1. 全局生效(全项目表格都移除表头分隔线)

直接编写全局CSS,覆盖Antd默认的表头单元格边框样式:

.ant-table-thead > tr > th {
  border-right: none;
}

2. 仅针对单个表格生效(推荐)

给目标Table组件添加自定义类名,避免影响其他表格:

<Table 
  className="custom-no-header-sep"
  columns={columns}
  dataSource={data}
  // 其他配置项
/>

然后编写对应局部CSS:

.custom-no-header-sep .ant-table-thead > tr > th {
  border-right: 0;
}

3. 适配Antd 5.x的主题变量写法(更优雅)

如果使用Antd 5.x版本,可以利用官方提供的CSS变量来修改:

.custom-no-header-sep .ant-table-thead > tr > th {
  --ant-table-header-cell-border-right: none;
}

以上方法都能快速移除表头列之间的分隔线,同时保留表格其他区域的边框样式(如果需要)。

内容的提问来源于stack exchange,提问作者sneha

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.02 17:08:11