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 trialStephen Ciantar
3,671 Pointswhy would the following code not pass please?
body { font-family: 'Nunito', sans-serif; color: #FAF3BC; background-color: #420600 url('img/bg-texture.png') repeat; }
7 Answers
Adam Sackfield
Courses Plus Student 19,663 PointsThis will pass
body {
font-family: 'Nunito', sans-serif;
color: #FAF3BC;
background: #420600 url('img/texture.png') repeat;
}
Stephen Ciantar
3,671 PointsI'm trying to pass background color and a background image just in case. background color alone works but as soon as i add url it does not
Stephen Ciantar
3,671 Points'''body { font-family: 'Nunito', sans-serif; color: #FAF3BC; background-color: #420009 url(img/bg-texture.jpg) repeat; }'''
Diane Houghton
5,773 PointsYou have to select each element like this: body { font-family: 'Nunito', sans-serif; color: #FAF3BC; background-color: #420600; background-image: url('img/bg-texture.png'); background-repeat: repeat; }
Stephen Ciantar
3,671 Pointsthanks very much Diane. I tried it alone with the background-image but not with background-repeat. I managed your way
Ricardo Hill-Henry
38,442 PointsAdam Sackfield's answer should work. background-color does not take in a url() value, it simply accepts any of the color methods CSS supports. In this case you can use the background property, which is a shorthand in which combines the following background properties: background-color background-image background-repeat background-attachment background-position
It does not matter if one of the properties are missing, as long as the ones that are present are in this order.
Adam Sackfield
Courses Plus Student 19,663 PointsIt does indeed work, I ensured it passed before posting :)
Stephen Ciantar
3,671 PointsThank you all for your replies. I checked Adam's as well and it did work. Thanks again
Adam Sackfield
Courses Plus Student 19,663 PointsAdam Sackfield
Courses Plus Student 19,663 PointsWould need to know what the question was in order to ascertain what is incorrect.