How to change bootstrap navigation menu colors?

前端 未结 3 1422
渐次进展
渐次进展 2021-01-17 05:39

I want to change the color of the \"Home\" \"Spin\" \"Social Media\" but no clue how. I spent a few days on figuring out how to change the navigation background but

3条回答
  •  鱼传尺愫
    2021-01-17 06:18

    This is a relatively comprehensive breakdown of the navigation components and often changed properties. I would suggest using a custom class in your main navbar div (navbar-custom is used for this example) to avoid changing the base CSS directly.

    /***Navbar Background Color, Border Removed ,Border Radius Sqaure***/
    
    .navbar.navbar-custom {
      background: #66ccff;
      border: none;
      border-radius: 0;
    }
    /***Link Color***/
    
    .navbar.navbar-custom .navbar-nav > li > a {
      color: #f00;
    }
    /***Link Color Hover Statr***/
    
    .navbar.navbar-custom .navbar-nav > li > a:hover {
      color: #ff0;
    }
    /***Link Background and Color Active State***/
    
    .navbar.navbar-custom .navbar-nav > .active,
    .navbar.navbar-custom .navbar-nav > .active > a,
    .navbar.navbar-custom .navbar-nav > .active > a:hover,
    .navbar.navbar-custom .navbar-nav > .active > a:focus {
      background: #DBF022;
      color: #66ccff;
    }
    /***Navbar Brand Link Color***/
    
    .navbar.navbar-custom .navbar-brand {
      color: #f00;
    }
    /***Navbar Brand Link Color Hover State***/
    
    .navbar.navbar-custom .navbar-brand:hover {
      color: #ff0;
    }
    /***Dropdown Background Active State***/
    
    .navbar.navbar-custom .nav li.dropdown.open > .dropdown-toggle,
    .navbar.navbar-custom .nav li.dropdown.active > .dropdown-toggle,
    .navbar.navbar-custom .nav li.dropdown.open.active > .dropdown-toggle {
      background: #DBF022;
      color: #f00;
    }
    /***Dropdown-menu Background Color***/
    
    .navbar.navbar-custom .dropdown-menu {
      background: #66ccff;
      border: none;
    }
    /***Dropdown-menu Color***/
    
    .navbar.navbar-custom .dropdown-menu > li > a {
      color: #f00;
    }
    /***Dropdown-menu Color Hover and Focus State***/
    
    .navbar.navbar-custom .dropdown-menu > li > a:hover,
    .navbar.navbar-custom .dropdown-menu > li > a:focus {
      color: #ff0;
      background: #f00;
    }
    /***Toggle Button***/
    
    .navbar.navbar-custom .navbar-header .navbar-toggle {
      border-color: #f00;
    }
    /***Toggle Button Hover and Focus State***/
    
    .navbar.navbar-custom .navbar-header .navbar-toggle:hover,
    .navbar.navbar-custom .navbar-header .navbar-toggle:focus {
      background: #f00;
      border: #f00;
    }
    /***Collapse Borders***/
    
    .navbar.navbar-custom .navbar-collapse {
      border: none;
    }
    @media (max-width: 767px) {
      .navbar.navbar-custom li.dropdown .dropdown-menu > li > a {
        color: #f00;
      }
      /***Dropdown-menu Color Hover and Focus State***/
      .navbar.navbar-custom li.dropdown .dropdown-menu > li > a:hover,
      .navbar.navbar-custom li.dropdown .dropdown-menu > li > a:focus {
        color: #ff0;
        background: #f00;
      }
    }
    
    
    
    

提交回复
热议问题