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 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
231,122 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.