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

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
STAFF
Guil Hernandez
Treehouse Teacher

Hi Matthew,

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

Thanks!

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.