Simply put, src means I want to load this resource, and href means I want to establish association with this resource
src is mainly used for element replacement, and href is used to establish related links with related documents and external resources.
The href property indicates that the local web resource and defined resources have been linked.
like:
<link href=style.css rel=stylesheet/>
The browser knows that this resource is a style sheet and will not stop when parsing this element, but the rendering page may stop because the browser needs style rules to render the page.
The browser will not load the css file content into the style tag. Therefore, we recommend using link tags instead of @import to load stylesheets.
The src attribute will embed the corresponding resource to the current page. like:
<script src=script.js></script>
When the browser loads and processes the page, it is until script.js is found and JS is compiled. The subsequent page compilation and parsing work will continue.
The content of JS will be loaded into the script tag. This is very similar to the img tag. The browser parses to the img tag, and the response image will be loaded and placed into the img tag.
This is why you need to put the jS file at the end of the document to load it. Before the tag.
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.