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 CSS Foundations Backgrounds and Borders Background Properties

Elena Paraschiv
Elena Paraschiv
9,938 Points

It does not work to add the background-image : url to body?

Hei. I seem to not be able to add the pattern to the body. I don't understand why. Imgur

Steven Snary
Steven Snary
17,540 Points

Is your index.html file in the simplu directory? The reason I ask is because your code is looking for the eight_horns.png file in an img directory off of the directory of the index.html file.

Also can you confirm that the extension of the eight_horns file is a png?

4 Answers

Daan Grootenboer
Daan Grootenboer
12,479 Points

I think your relative path is wrong!

Try this...

body {
    background-image: url("../img/eight_horns.png");
}

Take a look at this video for more explanation.

Elena Paraschiv
Elena Paraschiv
9,938 Points

That worked out great! Thanks for the explaining video too

Julie Myers
Julie Myers
7,627 Points

You're CSS coding is correct. It is probably the path to the image that off a bit. Depending on how you have your file structure set up, you might need to do any of the following:

body {
  background-image: url("../img/fileName");
}

body {
  background-image: url("/img/fileName");
}
Daan Grootenboer
Daan Grootenboer
12,479 Points

Almost at the end of the code you have this peace of code ...

body{
    background-image:url("img/logo_x_pattern.png");
}

Try to remove this ;)

Daan Grootenboer
Daan Grootenboer
12,479 Points

Did you remove your second question?

Elena Paraschiv
Elena Paraschiv
9,938 Points

Hi Dan, Yes. The problem got solved.I noticed that immediately after posting and deleted it.Thank you for your fast input nonetheless.