HTML Link Options Illustrated With Code Examples
- Element of
- HTML Anchors: Here’s How To Create Links For Fast Navigation
- What does
HTML Link Options Illustrated With Code Examples
do? - The <link> element is used to define a relationship between an HTML document and an external resource. This element is most commonly used to define the relationship between a document and one or more external CSS stylesheets.
- Display
- none
- Usage
- semantic | structural
About Document Links
When most people talk about links on the web, they mean anchor links — a link within the content of a page, which is anchored to a piece of text, or an image. But you can also define a link from one document to another, using the <link>
tag. This allows you to import the contents of a script or resource, such as a stylesheet, into your HTML document. You can then control the appearance or behavior of all pages by altering the content in your linked resource page.
<link rel="stylesheet" type="text/css" href="http://mysite.com/styles.css">
The <link>
element can also be used to link different versions of a page together. This is helpful if you have multiple translations of the same content. The following example describes an alternate version in Japanese, using the ISO 639-1 language code.
<link rel="alternate" hreflang="ja" href="http://mysite.com/es.php">
A HTML document can have multiple <link>
elements to load different script or page types. All of these <link>
elements must be placed in the <head>
section of the HTML document.
Browser Support for link
All | All | All | All | All | All |