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

HTML Build a Simple Website Styling Content Fonts and Colors

Sara Gonçalves
Sara Gonçalves
496 Points

Background

I'm having problems putting a background image on the entire website. It does recognize it. I wrote this:

body{ font-family: 'Nunito', sans-serif; color: #FAF3BC; background: #420600 url ('img/bg-texture.jpg') repeat; }

Can anyone help me ?

2 Answers

Jonathan Roosa
Jonathan Roosa
4,456 Points

Hello Sara.

It's very likely that the img folder isn't beneath the css folder, but rather is in the parent directory. I'm assuming this line of code is in style.css, so you'll need to add .. before the img in your background property. This way, the browser will look at the parent directory, and then into the img directory.

Here's how the code should look:

body{ font-family: 'Nunito', sans-serif; color: #FAF3BC; background: #420600 url ('../img/bg-texture.jpg') repeat; }

marcinlisewski
marcinlisewski
19,839 Points

Probably you have wrong path. Could you give link to your webpage.

In chrome try to inspect element and click in link of your image, if it won't open you should change path to image in code.

BR