PHP Build a Basic PHP Website 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,661 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
MOD
Jonathan Grieve
Treehouse Moderator 83,234 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!