Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS Framework Basics Prototyping with Bootstrap Working with Nested Grids and Responsive Images

Kevin Egstorf
Kevin Egstorf
26,590 Points

changing color nav-pills bootstrap

does anyone know how to change the color in de nav pills class in bootstrap? it is now blue and i would very much like to change it.

2 Answers

Lucas Santos
Lucas Santos
19,315 Points

Inspect that element with Firebug and get it's class or call the class if you already know it and in your style.css give it:

background: #000000;  /* with your desired color */

it should work but if it does not:

  1. make sure you called the class correctly
  2. make sure in your head where you called your css files to call your style.css LAST so it can override the bootstrap styles and 3. try giving it the !important call after your color. background: #000000 !important;

follow those steps and you can override any style in bootstrap. I do it all the time.

Hi Lucas,

!important should be used sparingly if at all. This isn't a situation where it's required. As long as you have at least matched the specificity of the selector used by bootstrap then you will be able to override the style without resorting to !important

Lucas Santos
Lucas Santos
19,315 Points

That's why I listed !important as 3rd. If the first 2 methods do not work and all else fails try !important.