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

Bootstrap 5变量覆盖失效问题:$table-cell-vertical-align修改无效果

问题原因

$table-cell-vertical-align是Bootstrap专门为表格组件定义的变量,该变量只会在表格样式模块中被调用,你当前的导入列表未引入_tables.scss文件,因此变量修改不会生效。

解决方法

在你配置的「可选Bootstrap CSS导入」段落中,新增表格模块的导入即可:

// 4. Include any optional Bootstrap CSS as needed
@import "../bootstrap/scss/utilities";
@import "../bootstrap/scss/reboot";
@import "../bootstrap/scss/type";
@import "../bootstrap/scss/images";
@import "../bootstrap/scss/containers";
@import "../bootstrap/scss/grid";
@import "../bootstrap/scss/helpers";
@import "../bootstrap/scss/tables"; // 新增表格模块导入

修改后重新编译,$table-cell-vertical-align的自定义值就会自动应用到所有使用.table类的表格元素上。

若新增导入后仍不生效,可通过浏览器开发者工具检查表格单元格的vertical-align属性,确认是否有后加载的自定义样式优先级更高,覆盖了Bootstrap的默认规则。


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.05 09:42:02