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 Basics (2014) Understanding Values and Units Em Units

Brice Franks
Brice Franks
1,488 Points

background-image

Hi,

I'm having trouble getting my background image to show up. What am I doing wrong?

Here is a copy of my syntax below.

HTML

<div id= "pic"> <p>Hello world and stars.</p> <p>This paragraph is not.</p> <p>Here are more cats for you.</p> <p>And no more.</p> </div>

CSS

#pic { background-image: url(img/spiritworld.jpg); color: red; }

4 Answers

In you css you have to place the path to your image inside quotations

#pic { 
background-image: url("img/spiritworld.jpg"); 
color: red; 
}
Alejandro Narvaja
PLUS
Alejandro Narvaja
Courses Plus Student 7,340 Points

You have in your html a space between id= and "pic". The correct way is: id="pic" without space between.

Brice Franks
Brice Franks
1,488 Points

i'm sorry when i copied the syntax i left out the # sign but it is in my css but will not show the image somehow.