html:navbar背景色不为';不变

html:navbar背景色不为';不变,html,css,twitter-bootstrap,Html,Css,Twitter Bootstrap,为什么这个导航栏背景不会改变 我需要把这个导航条放在一个黑色的背景中,但即使是!重要的参数我无法让它工作 css类甚至位于我的custom.css文件的底部 有什么不对劲吗 更新1: body { font-family: 'Roboto', sans-serif; } /* === NavBar === */ .nav-item { letter-spacing: .2em; font-size: 14px; text-transform: uppe

为什么这个导航栏背景不会改变

我需要把这个导航条放在一个黑色的背景中,但即使是
!重要的
参数我无法让它工作

css类甚至位于我的
custom.css
文件的底部

有什么不对劲吗

更新1:

    body {
    font-family: 'Roboto', sans-serif;
}

/* === NavBar === */
.nav-item {
    letter-spacing: .2em;
    font-size: 14px;
    text-transform: uppercase;
}


.dropdown-item {

}


/* == Footer ==== */

.my_footer {
    background-color: #5a6268;
}

.my_footer p {
    padding-top: 20px;
    font-size: 14px;
}


/* == Category Page == */

.my_row_class {
    padding-top: 15px;
}

.my_row_class .mx-auto p {

    color: #000;
    font-size: 12px;
}


.my_row_class .mx-auto p a {

    color: #000;
    font-size: 12px;
    text-decoration: none;
}

.my_image {
    width: 100%;
    height: auto;
}

.my_title {
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: .2em;
}

.my_image_padding {
    padding-top: 16px;
}

.my_bottom_margin {
    margin-bottom: 10px;
}

.card-body h4 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: .2em;
}

/*=== Product Page ==*/

.my_prod_row_class {
    padding-top: 15px;
    padding-bottom: 20px;
}

.my_prod_row_class .mx-auto p {
    color: #000;
    font-size: 12px;
}


.my_prod_row_class .mx-auto p a {
    color: #000;
    font-size: 12px;
    text-decoration: none;
}


.my_prod_title {
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: .2em;
    padding-top: 15px;
    padding-bottom: 10px;
}

.my_prod_text {
    padding-right: 20px;
}

/* === Pay With Card === */

.stripe-button-el {
    width: 100% !important;
    display: block !important;
    background-color: #868e96 !important;
    border: 0px !important;
    background-image: none !important;
}

.stripe-button-el span {
    display: block !important;
    position: relative !important;
}


.errorlist li {
    color: red;
    font-weight: bold;
}


.my_custom_div {
    margin-bottom: 20px !important;
}

.my_top_navbar_div {
    height: 60px;
    line-height: 50px;
}

.my_custom_menu {

    text-align: right !important;
}

.my_custom_menu ul li {
    list-style: none;
    color: black;
    text-transform: uppercase;
    letter-spacing: .2em;
    font-size: 12px;
    padding-right: 20px;
    display: inline;
}


.my_custom_menu ul li a {
    text-decoration: none;
    color: black;
    list-style: none;
    text-transform: uppercase;
    letter-spacing: .2em;
    font-size: 12px;
}





/* BOTONES JUMBOTRON */



.btn-azul {
  text-decoration: none;
  background-color: #5ba4e6;
  display: inline-block;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  color: #fff;
  font-weight: 700;
  font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
  text-shadow: 0 -1px 0 rgba(0,0,0,.25);
  letter-spacing: 0;
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
  -webkit-box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
  -ms-box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
  -moz-box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
  -o-box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
  background-image: linear-gradient(to bottom,rgba(255,255,255,.09) 0%,rgba(0,0,0,.09) 100%);
  font-size: 1.4rem;
  padding: 22px 30px;
  border-radius: 6px;
  border:none;
}

.btn-azul:focus {
    outline:none;
}


.btn-azul:hover {
  text-decoration: none;
  background-color: #7ab6eb;
  display: inline-block;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  color: #fff;
  font-weight: 700;
  font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
  text-shadow: 0 -1px 0 rgba(0,0,0,.25);
  letter-spacing: 0;
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
  -webkit-box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
  -ms-box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
  -moz-box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
  -o-box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
  background-image: linear-gradient(to bottom,rgba(255,255,255,.09) 0%,rgba(0,0,0,.09) 100%);
  font-size: 1.4rem;
  padding: 22px 30px;
  border-radius: 6px;
  border:none;
}


.btn-naranja {
  text-decoration: none;
  background-color: #ffa31a;
  display: inline-block;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  color: #fff;
  font-weight: 700;
  font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
  text-shadow: 0 -1px 0 rgba(0,0,0,.25);
  letter-spacing: 0;
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
  -webkit-box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
  -ms-box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
  -moz-box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
  -o-box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
  background-image: linear-gradient(to bottom,rgba(255,255,250,.09) 0%,rgba(0,0,0,.09) 100%);
  font-size: 1.4rem;
  padding: 22px 30px;
  border-radius: 6px;
  border:none;
}

button.btn-naranja:focus {
    outline:none;
}




button.btn-naranja:hover {
  text-decoration: none;
  background-color: #ffad33;
  display: inline-block;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  color: #fff;
  font-weight: 700;
  font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
  text-shadow: 0 -1px 0 rgba(0,0,0,.25);
  letter-spacing: 0;
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
  -webkit-box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
  -ms-box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
  -moz-box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
  -o-box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
  background-image: linear-gradient(to bottom,rgba(255,255,255,.09) 0%,rgba(0,0,0,.09) 100%);
  font-size: 1.4rem;
  padding: 22px 30px;
  border-radius: 6px;
  border:none;
}






/* ==================== */

.btn-xlarge {
    padding: 18px 28px;
    font-size: 22px;
    line-height: normal;
    -webkit-border-radius: 8px;
       -moz-border-radius: 8px;
            border-radius: 8px;
    }



nav.navbar {padding: 0 1rem;}

li.nav-item:hover {
  background-color: saddlebrown;
}


/*=== NAVBAR === */


.navbar-bg {
    background-color: black !important;
}
我认为这与保存在“缓存”中的mi css文件有关

当我评论我所有的css分类时,页面看起来是一样的。但是,当我通过控制台直接在HTML中删除/添加类时,我会看到页面中的更改

我已经用
CTRL+F5
刷新了我的页面,但没有任何效果。我要提到的是,这是一个在PyCharm 2018年与Django一起开发的网页。

尝试以下方式:

<nav class="navbar navbar-expand-md bg-dark fixed-top">

并从css文件中删除
.navbar bg
类。

请尝试以下方法:

<nav class="navbar navbar-expand-md bg-dark fixed-top">

并从css文件中删除
.navbar bg
类。

好吧,您的代码可以正常工作(刚刚测试过)

它不适用于您的原因可能是您的浏览器保存了网页的缓存版本

因此,在浏览器中,尝试“硬重新加载”以删除任何可能的缓存版本并重新加载页面

要在Chrome中实现这一点:打开开发者工具(点击F12),然后右键单击浏览器的刷新图标。选择“空缓存和硬重新加载”,看看它是否适合您。

好吧,您的代码可以工作(刚刚测试过)

它不适用于您的原因可能是您的浏览器保存了网页的缓存版本

因此,在浏览器中,尝试“硬重新加载”以删除任何可能的缓存版本并重新加载页面


要在Chrome中实现这一点:打开开发者工具(点击F12),然后右键单击浏览器的刷新图标。选择“空缓存和硬重新加载”,看看它是否适合您。

我也有同样的问题。答案是这样的。请在此处查看您的代码:

<link rel="stylesheet" href="/static/css/custom.css">
<link rel="stylesheet" href="/static/css/bootstrap.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css"


我也有同样的问题。答案是这样的。请在此处查看您的代码:

<link rel="stylesheet" href="/static/css/custom.css">
<link rel="stylesheet" href="/static/css/bootstrap.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css"


请添加custom.css文件。因为在codepen上工作:@DogukanCavus我编辑并添加了所有的
自定义.css
文件,直到工作:尝试以下代码:
.navbar bg{背景色:黑色!重要;z-index:999;}
请添加自定义.css文件。因为在codepen上工作:@dokukancavus我编辑并添加了所有的
自定义.css
文件,直到工作:尝试以下代码:
.navbar bg{背景色:黑色!重要;z-index:999;}
但是,它可以删除设置手动背景色的类navbar bg。如果我需要使用特定的颜色怎么办?bg dark是一个直接在引导程序中构建的颜色类,不需要创建自己的类来添加颜色…除非你不需要特定的颜色。如果你需要特定的颜色,请删除bg dark并创建自己的类是的,我知道,但这对我来说还不够黑。如何在css中设置自己的背景颜色?这就是我使用
.navbar bg
所做的。这并不能解决问题:(但是,删除设置手动背景色的类navbar bg是有效的。如果我需要使用特定的颜色怎么办?bg dark是直接在引导中构建的颜色类,不需要创建自己的类来添加颜色…除非你不需要特定的颜色。如果你需要特定的颜色,请删除bg dark并执行自己的类Yeah I k。)现在,但这对我来说还不够黑。我如何在css中设置我自己的bg颜色?这就是我用
.navbar bg
所做的。这并不能解决问题:(我认为是一样的,我甚至按了CTRL+F5并重新启动了电脑,但什么都没有。我认为是一样的,我甚至按了CTRL+F5并重新启动了电脑,但什么都没有。