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

CSS Treehouse Club: CSS My First Web Page What's New in Your HTML

Jodia Steenkamp
seal-mask
.a{fill-rule:evenodd;}techdegree
Jodia Steenkamp
Front End Web Development Techdegree Student 1,378 Points

What'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
Steven Parker
231,236 Points

The 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.

I had the same doubt, Nice explanation!