【发布时间】:2018-04-19 21:57:42
【问题描述】:
我仍在学习 BS4 和 SASS,但我不明白为什么设置我的原色没有被选中。
我创建了一个客户变量文件并设置了我想要的$blue 的颜色。这就是我在_custom-variables.scss 文件中的全部内容。
$blue: #0078D2;
$light: #F7F7F7;
然后在我的 site.scss 文件中导入它。
@import "scss/_custom-variables.scss";
@import "bootstrap/bootstrap.scss";
@import "scss/_my-theme.scss";
当我查看已编译的 CSS 文件时,我可以看到 $blue 设置为正确的值。
:root {
--blue: #0078D2;
--indigo: #6610f2;
--purple: #6f42c1;
但是,当我将以下内容用于表格标题时,它会显示默认的 BS4 蓝色,它比我要设置的蓝色要浅得多。这是编译后的 CSS 的 sn-p,您可以看到蓝色设置正确。
<table class="table table-striped table-bordered">
<thead>
<tr class="table-primary">
<th>File Name</th>
<th>File Date</th>
<th>Action</th>
</tr>
</thead>
奇怪的是,我有一些基本文本,我正在使用 text-primary 类,它正在使用我设置的 $blue 颜色。所以,table-primary 一定有什么东西,但我没有看到。我查看了我的 Bootstrap 文件夹中的_tables.scss,但我没有看到任何看起来像是在设置它的东西。当我在整个解决方案中搜索table-primary 时,我发现的只是编译后的 CSS 中的类,而不是任何 .scss 文件中的类。编译后的 CSS 中的 table-primary 具有较浅的蓝色。
这是拾取正确的蓝色。
<span class="text-primary">@ViewBag.FolderPath</span>
【问题讨论】:
标签: sass bootstrap-4