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

james heer
james heer
1,100 Points

background image in style sheet wont show

hi, i am having troubles with inserting a background-image into my css, the image does not show. bellow is my code..

<section class="main-banner">

.main-banner { width: 100%; height: 100vh; background-image: url("img/roof-slider1.jpg"); background-repeat: no-repeat; background-size: cover; }

the image is in a folder called img which is in the main root folder. the image name is correct. this seems to be happening on all of my projects and not just the 1 i am working on. any help would be much appreciated. Thank you

1 Answer

If you're running this locally, have you tried referencing your img files like this?

url("./img/roof-slider1.jpg");