Bootstrap dropdown menu text color

后端 未结 3 1577
花落未央
花落未央 2021-02-15 11:09

So i\'m working with Twitter\'s Bootstrap for the first time and I\'m trying to change the color of the text inside the dropdown menus once they have collapsed. (if that makes s

相关标签:
3条回答
  • 2021-02-15 11:27

    Apply simple css and you are done

    See this example:

    .navbar{height:70px; padding-top:20px; }
    

    will change height and padding of navbar - that is outter container

    .dropdown-menu{background:rgba(0,0,0,0.5); color:white; }
    

    will change background color of dropdown-menu - that is ul under dropdown link. All we have to understand the structure of navbar.

       .dropdown-menu li>a{color:white; }
       .dropdown-menu>li{padding:5px; border-bottom:1px solid white;border-left:1px 
                  solid white;border-right:1px solid white }
       .dropdown-menu li>a:hover{background:white; }
    
    0 讨论(0)
  • 2021-02-15 11:32

    previous answer is saying the same thing pretty much, but their syntax and commenting was a little confusing for me, so possibly it confused others too... you're first calling out the 'dropdown-menu' class, then the 'li' html element within that class, then, the 'a' html element nested within the 'li' element, so CSS looks like this:

    .dropdown-menu li a {
        color: white;
    }
    
    0 讨论(0)
  • 2021-02-15 11:33

    You should be able to use this CSS..

      /*-- change navbar dropdown color --*/
      .navbar-default .navbar-nav .open .dropdown-menu>li>a,.navbar-default .navbar-nav .open .dropdown-menu {
        background-color: #3344ff;
        color:#ffffff;
      }
    

    Demo: http://www.bootply.com/113750

    0 讨论(0)
提交回复
热议问题