Change navbar text color Bootstrap

前端 未结 12 1565
北恋
北恋 2020-12-13 19:53

I currently have this piece of html which represents the relevant part of my navbar:

相关标签:
12条回答
  • 2020-12-13 20:01

    Make it the following:

    .nav.navbar-nav.navbar-right li a {
        color: blue;
    }
    

    The above will target the specific links, which is what you want, versus styling the entire list blue, which is what you were initially doing. Here is a JsFiddle.

    The other way would be creating another class and implementing it like so:

    HTML

    <li><a href="#" class="color-me"><span class="glyphicon glyphicon-list-alt"></span> R&eacute;sum&eacute;</a></li>
    

    CSS

    .color-me{
        color:blue;
    }
    

    Also demonstrated in this JsFiddle

    0 讨论(0)
  • 2020-12-13 20:01

    For changing the text color in navbar you can use inline css as;

    <a style="color: #3c6afc" href="#">
    
    0 讨论(0)
  • 2020-12-13 20:05

    As of bootstrap 4, the answer is to simply set navbar-dark in the nav element, which will set the text and links to a light theme .

    <nav class="navbar navbar-dark">
    
    0 讨论(0)
  • 2020-12-13 20:10

    this code will work ,

    .navbar .navbar-nav > li .navbar-item ,
    .navbar .navbar-brand{
                           color: red;
                          }
    

    paste in your css and run if you have a element below

  • define it as .navbar-item class

    eg .

    <li>@Html.ActionLink("Login", "Login", "Home", new { area = "" },
     new { @class = "navbar-item" })</li>
    

    OR

    <li> <button class="navbar-item">hi</button></li>
    
0 讨论(0)
  • 2020-12-13 20:12

    Try this

    .nav.navbar-nav.navbar-right li a span{
        color: blue;
    }
    

    If it doesn't work try this

    .nav.navbar-nav.navbar-right li a {
        color: blue;
    }
    
    0 讨论(0)
  • 2020-12-13 20:12

    Try this in your css:

    #ntext{
     color: #000000;
      }
    

    Then the following in all your navigation bar list codes:

    <li><a href="#" id="ntext"><span class="glyphicon glyphicon-user"></span> About</a></li>
    
    0 讨论(0)
  • 提交回复
    热议问题