简体   繁体   English

在Twitter Bootstrap 4中设置导航栏主题

[英]Theming the navbar in Twitter Bootstrap 4

The Twitter Bootstrap documentation offers no explanation with the following navbar example Twitter Bootstrap文档未提供以下导航栏示例的解释

<nav class="navbar navbar-dark bg-inverse">
  <!-- Navbar content -->
</nav>

<nav class="navbar navbar-dark bg-primary">
  <!-- Navbar content -->
</nav>

<nav class="navbar navbar-light" style="background-color: #e3f2fd;">
  <!-- Navbar content -->
</nav>

there is the image output of the above examples biut no explanation on how they actually affects the navbar. 以上示例的图像输出没有解释它们实际上如何影响导航栏。 Can somebody explain how they work? 有人可以解释他们如何工作吗?

As you can see using the image example using the documentation Color schemes each class affects the navbar with a couple of different css attributes. 如使用图像示例和文档配色方案所见,每个类都通过几个不同的CSS属性影响导航栏。 If you need to know which exact styles, you can check this easily by simply trying it out. 如果您需要了解确切的样式,只需尝试一下即可轻松进行检查。

Although you could check bootstrap v4alphas github page to read through their SCSS files. 虽然您可以检查bootstrap v4alphas github页面以通读其SCSS文件。 For example these are changes made using .navbar-light : 例如,这些是使用.navbar-light进行的更改:

// Dark links against a light background
.navbar-light {
  .navbar-brand {
    color: $navbar-light-active-color;

    @include hover-focus {
      color: $navbar-light-active-color;
    }
  }

  .navbar-nav {
    .nav-link {
      color: $navbar-light-color;

      @include hover-focus {
        color: $navbar-light-hover-color;
      }
    }

    .open > .nav-link,
    .active > .nav-link,
    .nav-link.open,
    .nav-link.active {
      @include plain-hover-focus {
        color: $navbar-light-active-color;
      }
    }
  }

  .navbar-divider {
    background-color: rgba(0,0,0,.075);
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM