The HTML <link> tag is used for defining a link to an external document/resource. It is placed in in the <head> section of the document.
The <link> tag is commonly used for linking to an external style sheet.
Note: Despite its name ("link"), the link tag is not used for creating a hyperlink to another HTML document.
If you need to link to another HTML document, use the HTML <a> tag.
Required Attributes
- link must appear within the head element.
Optional Attributes
- href can be used to specify the target of a link.
- charset can be used to specify the character set of the target of a link.
- type can be used to specify the MIME type of the target of a link.
- hreflang can be used to specify the language (in the form of a language code) of the target of a link. It should only be used when href is also used.
- rel can be used to specify the relationship of the target of the link to the current page.
- rev can be used to specify the relationship of the current page to the target of the link.
- mediacan be used to specify which media the link is associated to. A value such as screen, print, projection, braille, speech or all can be used or a combination in a comma-separated list.
- Common attributes
Example
<link rel="stylesheet" type="text/css" href="../default.css" />
Changes in HTML5
Related Tags