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.

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 {}.