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

HTML How to Make a Website Styling Web Pages and Navigation Polish the Navigation and Footer

Jason Ruby
Jason Ruby
2,867 Points

footer a {} versus .social-icon{}

Nick stated that declaring class="social-icon" in the anchors of the footer was done to show how a class can be used multiple times on a given page as opposed to declaring a single unique ID. He stated that when modifying the the footer we could have simply referenced the anchors nested within the footer (e.g. footer a {}). I had this thought prior to watching the video and tried it, but it didn't work so I assumed I had done something incorrectly. Then Nick said the same thing in the video, so I tried it again:

footer a { width: 20px; height: 20px; margin: 0 5px; }

It did not produce the same results as:

.social-icon{ width: 20px; height: 20px; margin: 0 5px; }

Why?

3 Answers

with the footer a {} you are targeting every link the footer.

with .social-icon {} you are targeting only the elements that have the class of "social-icon".

Does that answer your question?

I will add that it would be eaiser if we could see the html and css code you are talking about. you can check the markdown cheatsheet at the bottom of this page to see how to post code in to the forums.

Jason Ruby
Jason Ruby
2,867 Points

Thanks, Shawn. That makes sense.

Nathaniel Simone
Nathaniel Simone
4,608 Points

I think the issue is that the social-icon class was applied to the image elements not the anchor elements. If you used footer img {} instead of footer a {} it should work the same as .social-icon {}.