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 Bootstrap 4 Basics (Retired) Building Forms with Bootstrap Custom CSS

Problem changing the color of the background

Hi guys,

I wanted to custom the color of the navigation :

I tried :

.nav .container{

background-color:#.....;

}

Unfortunately it is not working -do you have some hint for me ?

Thanks guys,

3 Answers

David Schriever
David Schriever
1,777 Points

Hey Roland, I assume that nav is your element and not your class, so if you remove the '.' it should work.

Hi Rolan, can you show a code?

Remember the class defined in Bootstrap is .navbar - however, your CSS only targets the container. If you want to change the colour of the whole navbar you'll need to remove whichever colour class is defined in the HTML (it's .bg-primary) in the example that Guil presents. Otherwise you'll need to declare !important, I'd recommend removing the redundant class.

.navbar {
background: #-----!important;
}