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 do you link icons to icon images when using a tags?

I need help linking icons to icon images and updating the href attribute to link to my personal pages.

Steven Parker
Steven Parker
229,732 Points

Are you just asking about how to make an image be a clickable hyperlink? If not, can you elaborate a bit and perhaps show the current code?

2 Answers

Steven Parker
Steven Parker
229,732 Points

To make an icon, or any image, into a hyperlink you only need to enclose it within an anchor (<a>) element and set the href value of the anchor to the URL you want to link to. For example:

<a href="http://my.website.com/profile.html">
    <img src="images/myIcon.jpg" alt="My Profile">
</a>

I am looking to make social media icon images link to my personal profile pages.