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

editor shows background-image, browser does not (localhost)?

I'm trying to a background-image via CSS to a div. When I preview the site with the editor I'm using (Coda2) it looks fine. But when I try any browser, the image doesn't show up at all - just a blank space, where the image should be. No broken icon, or anything. It doesn't seem to matter what the other settings are in regards to background-size, height, etc. - it always shows correctly in the editor, but nothing in browser. Paths are correct, files are saved...

What could possibly be the reason why Coda displays the image in preview but Chrome, Firefox and Safari are just blank?

1 Answer

Did you check with the "developer tools" in Chrome/Firefox what the browser is doing with your background image, when it loads the website?

  1. Show us some relevant code...

  2. First three Stackoverflow results by Google...already checked them out? TL;DR try disable AdBlock before you load the page. http://stackoverflow.com/questions/5546397/div-background-image-not-displayed-in-firefox-and-chrome

Hey Tobias, Thank You! I never thought to check developer tools and the image wasn't loading due to the oath differences between loading from my CSS file vs the HTML. Completely slipped my mind having to go up one directory from my CSS file, when Coda knew where it was and was applying changes as if all was fine.

I'm going to go break down a wall using my head!

Thanks again!