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 Unused CSS Stages Transitions and Transforms 3D Transforms: Part 1

Vicky Kumar
Vicky Kumar
5,742 Points

Why background: url(' ') is not working in any browser?

Hi!

My CSS code:

... .wrap { background: url('treehouse.png'); } or .wrap { background: url('img/treehouse.png') no-repeat 0 0; }

these codes are 100% right but still I'm not able to see my image in any browser like Chrome or Firefox.

3 Answers

Kevin Kenger
Kevin Kenger
32,834 Points

Hey Vishwa,

Do you have two folders in your root directory; one for CSS and one for images? If so you'll need to modify your file path to correctly locate your background image.

.wrap {
    background: url('../img/treehouse.png');
}

.. means parent directory, so now we go back out into the root folder, then into the images folder where your image is.

However, if this isn't the case, my only other theory is that there might be something wrong in your HTML.

Jayden Spring
Jayden Spring
8,625 Points

That should work, are you sure your image path exists? I suggest using an inspector such as Firebug to have a look.

Vicky Kumar
Vicky Kumar
5,742 Points

Hey Kevin,

Thanks man. It really worked.