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
SABCD ABCD
3,414 PointsHow do you add an image in the css file?
Referring to http://teamtreehouse.com/library/build-a-simple-php-application , I am trying out the extra credit section in step 2. One of the items required is to add a background image to the navbar to "company information" using the css file.
How do I do this? I tried looking through the css to find out how the other images (eg. shirts and contact pages) for the other pages were done by Randy. I am not really sure what I should be doing here.
Thank you very much in advance for your explanation on this.
1 Answer
Phil Arnold
11,331 PointsHi Sanjay,
you can add images to be displayed on your site via CSS using the "background" property.
navbar {
background-image: url("insert path to image");
}
Probably worth your while reading up via W3C for a more detailed explanation as background images can be challenging to get to grips with as there are many things you can do via CSS.
You could also watch a video on background properties here on TeamTreehouse
Hope this helps.
SABCD ABCD
3,414 PointsSABCD ABCD
3,414 PointsHi Phil!
Thank you very much for your post. While it was useful for general purposes, I still don't quite know how to do it within the css file that has been uploaded by Randy. It seems a little more complex. The problem is, I can't quite figure out how he did it with his own images. Basically, I don't know where I should be writing this code within that specific css file.