Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP Build a Basic PHP Website (2018) Building a Media Library in PHP Adding Active States to the Navigation

Adding an icon to an existing image sprite

Extra Credit

Add another page to the menu for something like "Company Information." You'll need to complete the following steps:

1.Create a new PHP file for the page, making sure to set the $section variable.
2.Modify header.php to display the new menu item, making sure that it is underlined when someone is on the new page.
3.Create an icon for the menu item.
4.Modify the CSS file to display that new icon, as well as to make room for the extra item in the menu.

Hi all, Regarding the above challenge,I have been able to accomplish tasks 1-3 but I am unable to do task 4 of adding the icon to the nav bar.Any assistance will be appreciated.

Simon Coates
Simon Coates
28,693 Points

Jonathan Grieves is probably right about the css property background-image. You do seem to be able to use this to add images in cases where an img element isn't appropriate. (I have a recollection that one of the course involved using background-image and margins/spacing to create custom list element bullets). However, if you haven't covered CSS yet, it might be something you'll learn at a later point.

There are a couple different background properties or you can use background (See https://www.w3schools.com/cssref/css3_pr_background.asp ) for doing multiple things in one go. I don't recall the circumstances well enough to know why you'd want a css solution over just an img tag. I'm a little vague as to what Alena was thinking.

1 Answer

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 90,797 Points

Hi Jackline,

Great job on finishing the first few tasks. :)

If you're modifying the CSS to display the image icon it sounds like you want to use the background-image property. Look for the location of the image in your workspace or on your file system and pass in the relative path and file name for your image!