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.

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,640 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