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 trialBrice Franks
1,488 Pointsbackground-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
Ella Ruokokoski
20,881 PointsIn you css you have to place the path to your image inside quotations
#pic {
background-image: url("img/spiritworld.jpg");
color: red;
}
james south
Front End Web Development Techdegree Graduate 33,271 Pointsto reference an id in css you need the pound/hashtag/octothorpe (#) symbol, so here the selector would be #pic.
Alejandro Narvaja
Courses Plus Student 7,340 PointsYou have in your html a space between id= and "pic". The correct way is: id="pic" without space between.
Brice Franks
1,488 Pointsi'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.