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

Jodia Steenkamp
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
179,852 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!