相关疑难解决方法(0)

不能将主题颜色与文本或背景一起使用

我在我的 scss 文件中覆盖 bootstrap theme-colors,如下所示

// set variables
$primary: #8dc3a7;
$light: #b4d6c1;
$starorange: #df711b;

// import functions and variables
@import "../node_modules/bootstrap/scss/functions";
@import "../node_modules/bootstrap/scss/variables";

$custom-theme-colors: (
  "starorange": $starorange,
);

// modify theme colors
$theme-colors: map-merge($theme-colors, $custom-theme-colors);

// bootstrap import
@import "../node_modules/bootstrap/scss/bootstrap";
Run Code Online (Sandbox Code Playgroud)

我可以在按钮中使用starorange颜色,如下所示,并且它正确应用了颜色

<button class="btn btn-md btn-starorange">Send</button>
Run Code Online (Sandbox Code Playgroud)

但是,我无法同一个 HTML 文档中为文本或背景使用相同的颜色,如下所示。

<div class="pb-1 text-starorange">
    <i class="bi bi-star-fill"></i>
    <i class="bi bi-star-fill"></i>
    <i class="bi bi-star-fill"></i>
    <i class="bi bi-star-fill"></i>
    <i class="bi bi-star-fill"></i>
</div>
Run Code Online (Sandbox Code Playgroud)

或者

<section class="bg-starorange">
     .... some html here ... …
Run Code Online (Sandbox Code Playgroud)

css sass bootstrap-5

5
推荐指数
1
解决办法
3499
查看次数

标签 统计

bootstrap-5 ×1

css ×1

sass ×1