Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS Bootstrap Basics Building Forms With Bootstrap Add Custom CSS to Your Bootstrap Site

Matthew Armstrong
Matthew Armstrong
5,711 Points

Background-color property conflict

The changes to background image worked fine but when I tried to change the background color myself there was a conflict with the bootstrap CSS. My sheet comes after it in the HTML. It seems the bg-dark theme is over riding my custom CSS even though it comes before it. Is this to do with how bootstrap applies these color schemes or is something else up?

I have a bg-dark theme in my HTML since jumbotron is no longer a distinct feature of bootstrap 5 (from what I could see)

1 Answer

Steven Parker
Steven Parker
216,810 Points

Remember that cascade order is the least important factor in determining the priority of a rule. The specificity of the selector is more important, so for example if your rule targets by tag name but the other rule targets by class, the class rule will override. Find the rule that is applying the style you see, and give your rule an equal or better specificity.

For more details, see the MDN page on Specificity.