HTML CSS Bootstrap Javascript Icons Python
HTML References
HTML - Tag Reference HTML - Tag by Category HTML - Attributes HTML - Global Attributes HTML - Events HTML - Language Codes HTML - Country Codes HTML - URL Encoding HTTP Methods HTTP Status Codes <input> types
All HTML Tags
<!-- --> <!DOCTYPE> <a> <abbr> <acronym> <address> <applet> <area> <article> <aside> <audio> <b> <base> <basefont> <bdi> <bdo> <big> <blockquote> <body> <br> <button> <canvas> <caption> <center> <cite> <code> <col> <colgroup> <data> <datalist> <dd> <del> <details> <dfn> <dialog> <dir> <div> <dl> <dt> <em> <embed> <fieldset> <figcaption> <figure> <font> <footer> <form> <frame> <frameset> <h1> - <h6> <head> <header> <hr> <html> <i> <iframe> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <main> <map> <mark> <meta> <meter> <nav> <noframes> <noscript> <object> <ol> <optgroup> <option> <output> <p> <param> <picture> <pre> <progress> <q> <rp> <rt> <ruby> <s> <samp> <script> <section> <select> <small> <source> <span> <strike> <strong> <style> <sub> <summary> <sup> <svg> <table> <tbody> <td> <template> <textarea> <tfoot> <th> <thead> <time> <title> <tr> <track> <tt> <u> <ul> <var> <video> <wbr>

HTML <link> tag

The HTML <link> element specifies relationships between the current document and an external resource.

It is placed in the <head> section of the document.

This element is most commonly used to link to stylesheets, but is also used to establish site icons (both "favicon" style icons and mobile home screen/app icons) among other things.

This element is an empty element which means that it has no end tag.

Run code

Browser compatibility

The <link> element is fully supported by all browsers:

Element
<link> yes yes yes yes yes



Attributes

The following table shows the attributes that are specific to the <link> tag:

HTML5 is new in HTML5

Attribute Value Description
charset character-set Not supported in HTML5.
Specifies the character encoding of the linked document
crossorigin anonymous
use-credentials
Specifies how the element handles cross-origin requests
href URL Specifies the location (URL) of the linked document
hreflang language-code Specifies the language of the linked resource
media media_query Specifies on what device the linked document will be displayed
rel alternate
author
dns-prefetch
help
icon
license
next
pingback
preconnect
prefetch
preload
prerender
prev
search
stylesheet
Specifies the relationship between the current document and the linked document
rev reversed relationship Not supported in HTML5.
Specifies the relationship between the linked document and the current document
sizes HeightxWidth
any
Specifies the size of the linked resource (only for rel="icon")
target _blank
_self
_top
_parent
frame_name
Not supported in HTML5.
Specifies where the linked document is to be loaded
type media-type Specifies the media type of the linked document

Global Attributes

The <link> tag supports the global attributes described in HTML Global Attributes Reference

Event Attributes

The <link> tag supports the event attributes described in HTML Events Reference

Last updated: Tuesday 25 Sep, 2018