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!

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: background-image has to be before background-color?

I was watching CSS Foundations > The Box Model > Backgrounds. I was following the lesson using Sublime Text 2 and Google Chrome to view the page changes.

As per the demo, I tried to set background-image: url('../images/fox.png'); after background-color: #777 and Sublime was showing me that background-image line was not completed properly (the text was plain white instead of styled). I ignored it, saved and refreshed the page. Nothing displayed. I moved the background-image line ABOVE the background-color line and everything worked perfectly.

Any idea why this is happening?

2 Answers

Guil Hernandez
Guil Hernandez
Treehouse Teacher

Hi Matthew,

Can you please post an example of your code? Or, create an example on CodePen.


Aaron Martone
Aaron Martone
3,290 Points

After showing your code, I would try to get familiar with Firebug on Google Chrome. It is an unfathomably wonderful tool that will help you troubleshoot these kinds of issues.

The sequence of order between these two properties should be no difference. Were you using background-image or just background? The latter is shorthand and can sometimes override things if we don't make the discernment.