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
Jacob Tennyson
6,240 PointsBackground Properties
Can background properties be applied to a body class or id selector? I was having trouble yesterday getting a background to come through my page. It worked when i just selected the body but when i made a class or an id nothing showed up. I wanted to make different backgrounds for different pages.
Jacob Tennyson
6,240 PointsFrom what i can see yes. Now does there have to content in the body for it to work? Because i just used the same code on my h1 element and it worked. And i just made h1 a class and tried it and it worked as well. I guess i need to put something in the body ?
2 Answers
Jacob Tennyson
6,240 PointsFrom what i can see yes. Now does there have to content in the body for it to work? Because i just used the same code on my h1 element and it worked. And i just made h1 a class and tried it and it worked as well. I guess i need to put something in the body ?
Ryan Decker
3,451 PointsCould you post your HTML and CSS code so I can see what you are doing?
Ryan Decker
3,451 PointsRyan Decker
3,451 PointsYes they can.
When you add a class are you doing it like this:
.classname {background: url('../img/somepic.jpg');}When you add an id are you doing it like this:
#idname{background: url('../img/somepic.jpg');}