HTML Linking Resources

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

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

AttributeDetails
charsetSpecifies the character encoding of the linked document
crossoriginSpecifies how the element handles cross origin requests
hrefSpecifies the location of the linked document
hreflangSpecifies the language of the text in the linked document
mediaSpecifies on what device the linked document will be displayed, often used with selecting stylesheets based on the device in question
relRequired. Specifies the relationship between the current document and the linked document
revSpecifies the relationship between the linked document and the current document
sizesSpecifies the size of the linked resource. Only when rel="icon"
targetSpecifies where the linked document is to be loaded
typeSpecifies the media type of the linked document
integritySpecifies a base64 encoded hash (sha256, sha384, or sha512) of the linked resource allowing the browser to verify its legitimacy.


Got any HTML Question?