如何更改导航栏颜色?

只是想学习 asp.net core mvc 并想知道我如何从默认 _Layout 给导航栏一个自定义背景颜色。

<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-dark bg-dark border-bottom box-shadow mb-3">
a714618777 回答:如何更改导航栏颜色?

navbar 是引导程序样式的一部分。

您在这里几乎没有选择。

  1. 难的是 customize the bootstrap theme
  2. 简单而快速的方法是覆盖 navbar,前提是这是您希望更改的内容。
  3. 中间的一个是使用一个页面来Generate your own Bootstrap navbar下载并应用它
,

您可以尝试更改布局中 class navbar 的颜色。最好添加 !important 否则 css 可能会被其他 css 覆盖。例如:

<style>
        .navbar {
            background-color: green !important;
        }
</style>

或者您可以创建一个新类并将该类添加到您想要的导航栏:

<nav class="customClass navbar navbar-expand-sm navbar-toggleable-sm navbar-dark bg-dark border-bottom box-shadow mb-3">
<style>
            .customClass {
                background-color: green !important;
            }
</style>
本文链接:https://www.f2er.com/30347.html

大家都在问