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 Build a Simple Website Styling Content Fonts and Colors

Stephen Ciantar
Stephen Ciantar
3,671 Points

why would the following code not pass please?

body { font-family: 'Nunito', sans-serif; color: #FAF3BC; background-color: #420600 url('img/bg-texture.png') repeat; }

Would need to know what the question was in order to ascertain what is incorrect.

7 Answers

This will pass

    body {
    font-family: 'Nunito', sans-serif;
        color: #FAF3BC;
        background: #420600 url('img/texture.png') repeat; 
     }
Stephen Ciantar
Stephen Ciantar
3,671 Points

I'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
Stephen Ciantar
3,671 Points

'''body { font-family: 'Nunito', sans-serif; color: #FAF3BC; background-color: #420009 url(img/bg-texture.jpg) repeat; }'''

You 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
Stephen Ciantar
3,671 Points

thanks very much Diane. I tried it alone with the background-image but not with background-repeat. I managed your way

Adam 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.

It does indeed work, I ensured it passed before posting :)

Stephen Ciantar
Stephen Ciantar
3,671 Points

Thank you all for your replies. I checked Adam's as well and it did work. Thanks again