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 trialJodia Steenkamp
Front End Web Development Techdegree Student 1,378 PointsWhat's the difference between "href" and "src" between <link> and <img>? Aren't they serving the same role?
I'm a little confused with the difference between "href" and "src" between <link> and <img>?
Do they not do the same think in showing the path to a file or folder and linking that to the code deck?
2 Answers
Steven Parker
231,275 PointsThe href attribute specifies a relationship with an external resource, but the src indicates where the location of the element's contents will come from.
Resources named by href may not be loaded until actually needed, but page loading is not complete until all src resources have been loaded into the page.
Manoel Filho
Full Stack JavaScript Techdegree Student 16,391 PointsI had the same doubt, Nice explanation!
Jodia Steenkamp
Front End Web Development Techdegree Student 1,378 PointsJodia Steenkamp
Front End Web Development Techdegree Student 1,378 PointsThanks Steven. That makes so much sense :)