Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failing at changing the text color in Bootstrap navbar

I've been trying to change the text color in a bootstrap template's navbar and have been unsuccessful. Anyone know where I'm going wrong? Here is my code.

<!--navbar-->
<div class="navbar navbar-fixed-top">
  <div class="navbar-inner" id="nav-inner">
    <div class="container">
      <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </a>
      <a class="brand" href="#">Restaurant</a>
      <div class="nav-collapse">
        <ul class="nav">
          <li class="active"><a href="#"><i class="icon-home icon-white"></i> Home</a></li>
          <li><a href="#">Link</a></li>
          <li><a href="#">Link</a></li>
          <li><a href="#">Link</a></li>
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret">   </b></a>
            <ul class="dropdown-menu">
              <li><a href="#">Action</a></li>
              <li><a href="#">Another action</a></li>
            </ul>
          </li>
        </ul>
        <form class="navbar-search pull-right" action="">
          <input type="text" class="search-query span2" placeholder="Search">
        </form>
      </div><!-- /.nav-collapse -->
    </div><!-- /.container -->
  </div><!-- /.navbar-inner -->
</div><!-- /.navbar -->
<!--navbar-->

The CSS:

.navbar-inner {
    color: #FFF;
}

I also tried this:

#nav-inner {
    color: #FFF;
}
like image 233
jfoutch Avatar asked Nov 18 '12 04:11

jfoutch


People also ask

How do I change the navbar brand text color in bootstrap?

Changing the text color The text color of the navigation bar can be changed using two inbuilt classes: navbar-light: This class will set the color of the text to dark. This is used when using a light background color. navbar-dark: This class will set the color of the text to light.

Which class is used to get background color the navbar black and text white?

You can specify the background color using the bg- classes: bg-light, bg-dark, bg-info, bg-danger, bg-primary, bg-warning, or bg-success . Use navbar-dark for lighter text color (white), or navbar-light for darker text color (black).

Which class is used in bootstrap to set the background color of the navbar to dark?

Color schemes Theming the navbar has never been easier thanks to the combination of theming classes and background-color utilities. Choose from .navbar-light for use with light background colors, or .navbar-dark for dark background colors. Then, customize with .bg-* utilities.

What is the color of navbar inverse?

The navbar-default gives a grayish look to the navigation bar while inverse gives it black. In order to customize the navigation bar as per the needs or match with the theme of your website, you need to work with these classes and override the default scheme or create your own custom class with the required properties.


3 Answers

If you want to change the css for the tabs you need to add color: #ddd; to the following

.navbar .nav > li > a {
    float: none;
    line-height: 19px;
    padding: 9px 10px 11px;
    text-decoration: none;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
    color:  #ddd;
}

Hope it helps!!

like image 123
uday Avatar answered Oct 19 '22 08:10

uday


My guess is that Bootstrap defines a more specific CSS rule that is winning out over your more general rule. You should examine the page with Firefox or Chrome's developer tools to see which styles are winning out over others. If your style doesn't even show up, then you know there's a more basic problem, but if Bootstrap's style is overriding your color, you have to give your style a higher precedence.

For a sanity check, try this overkill rule:

html body .navbar .navbar-inner .container {
    color: #FFF;
}

And if that works, then experiment with a lower level of specificity to see how specific you really need to get.

If all else fails, you can always do:

color: #FFF !important;

The CSS2 specification lays this out in detail.

like image 29
maackle Avatar answered Oct 19 '22 08:10

maackle


.navbar .nav > li > a {
    float: none;
    color: #5FC8D6;
    background-color: #002E36;
}
.navbar .nav > li > a:hover {
    float: none;
    color: #002E36;
    background-color: #5FC8D6;
}
like image 24
Daniel Raja Singh Avatar answered Oct 19 '22 07:10

Daniel Raja Singh