Linking Resources
suggest changeIntroduction
While many scripts, icons, and stylesheets can be written straight into HTML markup, it is best practice and more efficient to include these resources in their own file and link them to your document. This topic covers linking external resources such as stylesheets and scripts into an HTML document.
Syntax
<link rel="link-relation" type="mime-type" href="url"><script src="path-to-script"></script>
Parameters
Attribute | Details |
———–– | —–– |href | Specifies the location of the linked document. | crossorigin | Specifies how the element handles cross-origin requests. | hreflang | Specifies the language of the linked document. | media | Specifies which media the linked resource applies to, often a stylesheet. | rel | Required. Specifies the relationship between the current document and the linked document. | sizes | Specifies the size of the linked icon. Only when rel includes icon. | type | Specifies the media type of the linked document. | integrity | Specifies a base64-encoded hash (sha256, sha384, or sha512) of the linked resource so the browser can verify it. | charset | Obsolete on <link>. | rev | Obsolete. It was the reverse of rel. | target | Not a valid attribute of <link> in HTML5. Use it on <a> or <base>. |