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 trialbkjpkfikxu
2,303 PointsTrouble passing backgrounds and borders code challenge
I'm having trouble passing the advanced backgrounds code challenge in the backgrounds and borders section. Can anyone see what's wrong with this code? Here it is:
Thanks for helping :)
<!DOCTYPE html>
<html>
<head>
<title>Multiple Background Images</title>
<link rel="stylesheet" href="page.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="sketch"></div>
</body>
</html>
/* Complete the challenge by writing CSS below */
.sketch {
background: url('img/texture.jpg') #EED293, url('img/pencil.png') no-repeat left bottom, url('img/smiley.png') no-repeat right top;
}
Edit: Here's the link to the exercise, if it helps: https://teamtreehouse.com/library/css-foundations/backgrounds-and-borders/advanced-backgrounds
1 Answer
Colin Bell
29,679 PointsBackgrounds go from top to bottom. The first property set is on top, the last property set is on the bottom. So if you have url('img/texture.jpg') #EED293 first, that is going to be the top most background and it will actually cover up the other images.
.sketch {
background: url('img/pencil.png') left bottom no-repeat,
url('img/smiley.png') right top no-repeat,
url('img/texture.jpg') #EED293;
}
bkjpkfikxu
2,303 Pointsbkjpkfikxu
2,303 PointsAh, I see. That did it, thanks!
Colin Bell
29,679 PointsColin Bell
29,679 PointsNo problem. I like putting each layer on it's own line. It makes more sense visually since the top layer is on top, the bottom layer is on the bottom - like a tower, of sorts. If that makes sense, haha.
bkjpkfikxu
2,303 Pointsbkjpkfikxu
2,303 PointsYeah. I was doing it that way at first, but then I thought that might be what was causing the problem (maybe there can't be extra whitespace?), so I put them all on the same line. I see how it makes more sense to do it that way, that's helpful.