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 trialLeslie Mann
Courses Plus Student 228 Pointswhat is href attribute as in <a href=
Can you explain what the "href" in <a href=index.html"></a> means? just looking for some clarification on this. I think it is the code to add a link between 2 html files, is this correct?
3 Answers
Liam Maclachlan
22,805 Pointsan anchor tag Href specifies the destination of a link.
This could be an ID on a page or a link to another page :)
Leslie Mann
Courses Plus Student 228 Pointsthank you!!
Liam Maclachlan
22,805 PointsNo problem. Glad I could clear it up :)
Sam Donald
36,305 PointsIf you'r using the link to direct visitors to an image, video, article etc... on another site then a good idea would be to give your anchor tag a blank target, like this.
<a target="_blank" href="http://somedomain.com">some words</a>
This will make the liked page (the href attribute) open in another tab. This is good for external site links as it allows your site visitors to remain on your site while still delivering the content they were after.
Yonatan Schultz
12,045 PointsYonatan Schultz
12,045 Points<a> is an anchor tag in html. href within that anchor lets that anchor know where it will be referencing. This is typically used for links. For instance,
<a href="http://google.com">Google</a>
Will display a link to google.com