-
the difference
-
href: generally used on link tags and a tags
- Represents a hypertext reference, pointing to the location of a network resource, used to establish a link between the current document and the referenced resource
- The browser will recognize the document as a css document and download it without stopping the processing of the current document, which is why @import is not used in the document
<link href='./style.css' ref='stylesheet' />
<a href='https://www.baidu.com' />
-
src: generally used on script tags
- Reference resources (js scripts, images), and apply the target resource download to the current document
<script src=‘script.js’></script>
- When the browser parses the element, it will pause the rendering of the browser until the resource is loaded, which is why the js script is placed at the bottom
-
-
Summary
src is used to introduce files, and href is used to establish a link between the current document and reference resources
The difference between URL tag attribute href and src
Guess you like
Origin blog.csdn.net/Dajdhushvj/article/details/126829996
Recommended
Ranking