I'm trying to document a solid explanation between the technicals of the href
vs the src
attribute.
So with my understanding of href vs src..
- href - will link other external resources (e.g.
<a>
,<link>
) - src - while source attributes will embed and load them in replaced elements (such as the
<img>
,<iframe>
,<script>
)
Example:
- An
<a href="http://static-website.com/page">
will link to the page.html in an anchor tag but will not request it automatically or load it's contents directly on the document page. - However when using the
src
attribute in<iframe src="http://static-website.com/page">
it will then actually request it, embed and load the content in the document page.
So if you use an href
in a link tag <link href="./css/main.css">
why does it behave as though the CSS style rules have been actually loaded or embedded into the document to style the elements like a src
attribute?