How can I change the default background color of the nav bar?

This question already has an answer here:

  • Change navbar color in Twitter Bootstrap 13 answers

  • You haven't actually applied the navbar-custom class anywhere in your HTML. Add it to the end of the class list on the div with the class navbar .

    <div class="navbar navbar-inverse navbar-fixed-top navbar-custom">
    

    Change

    <div class="navbar navbar-inverse navbar-fixed-top">
    

    To

    <div class="navbar-custom navbar-fixed-top"> 
    

    在这里输入图像描述


    No need to change the classes. Just need to give your selector a higher specificity than the current "dominating" one:

    .navbar.navbar-inverse {
    background-color: #CC0000;
    }
    

    This will overrule the standard background.

    EDIT: If for any reason you prefer using navbar-custom, you'll have to add this class to the element and STILL make your selectors with a higher specificity. Eg:

    .navbar.navbar-custom { }
    
    链接地址: http://www.djcxy.com/p/89428.html

    上一篇: 如何更改引导程序导航栏的颜色?

    下一篇: 如何更改导航栏的默认背景颜色?