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 trialKevin Egstorf
26,590 Pointschanging 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
19,315 PointsInspect 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:
- make sure you called the class correctly
- 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.
Kevin Egstorf
26,590 Pointstnx for the help!
Lucas Santos
19,315 Pointsno problem
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsHi 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
19,315 PointsLucas Santos
19,315 PointsThat's why I listed !important as 3rd. If the first 2 methods do not work and all else fails try !important.