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

3 Questions about CSS

  1. I did not understand why the background for my button and the website is not working. Here's my CSS code:
body{
    font-family: "Nunito", sans-serif;
    color: #FAF3BC;
    background: #420600 url('img/bg-texture.jpg') repeat;
}

.btn{
    color: #FAF3BC;
    background: #4FB69F url('img/texture.png') no-repeat right top;
    padding: 15px 30px;
    margin: 40px; 0px; 
    border-radius: 25px;
    text-transform: uppercase;
}

I am pretty sure the link to my picture is correct since my other pictures are working except the background.

Thank you!

4 Answers

If your stylesheet is stored in a different directory than your HTML then the relative link might not be right.

For example, let's say all your images are in a directory called 'img/'. When you call up the webpage, it looks in its home directory for a subdirectory called 'img/'.

But now lets say your css is also stored in a subdirectory called 'css/'. If you reference an image from the stylesheet, then it will be looking for 'img/' in the 'css/' directory. SO, you need to specify the link as '../img/texture.png' - the '..' refers to the parent directory. Your exact solution will depend on how your files are stored.

Can you post the files in question including the html and css?

Thank you very much! Adding ../ before my img link works!

finally. thx for this