Diese Übersetzung ist unvollständig. Bitte helfen Sie, diesen Artikel aus dem Englischen zu übersetzen.


The HTML Link Element (<link>) specifies relationships between the current document and an external resource. Possible uses for this element include defining a relational framework for navigation. This Element is most used to link to style sheets.

Content categories Metadata content. If itemprop is present: flow content phrasing content
Permitted content None, it is an empty element.
Tag omission As it is a void element, the start tag must be present and the end tag must not be present
Permitted parent elements Any element that accepts metadata elements. If itemprop is present: any element that accepts phrasing content.
DOM interface HTMLLinkElement


This element includes the global attributes.

This attribute defines the character encoding of the linked resource. The value is a space- and/or comma-delimited list of character sets as defined in RFC 2045. The default value is ISO-8859-1.
Usage note: This attribute is obsolete in HTML5 and must not be used by authors. To achieve its effect, use the Content-Type HTTP header on the linked resource.
crossorigin HTML5
This enumerated attribute indicates if the fetching of the related image must be done using CORS or not. CORS-enabled images can be reused in the <canvas> element without being tainted. The allowed values are:
A cross-origin request (i.e. with Origin: HTTP header) is performed. But no credential is sent (i.e. no cookie, no X.509 certificate and no HTTP Basic authentication is sent). If the server does not give credentials to the origin site (by not setting the Access-Control-Allow-Origin: HTTP header), the image will be tainted and its usage restricted..
A cross-origin request (i.e. with Origin: HTTP header) is performed with credential is sent (i.e. a cookie, a certificate and HTTP Basic authentication is performed). If the server does not give credentials to the origin site (through Access-Control-Allow-Credentials: HTTP header), the image will be tainted and its usage restricted.
When not present, the resource is fetched without a CORS request (i.e. without sending the Origin: HTTP header), preventing its non-tainted used in <canvas> elements. If invalid, it is handled as if the enumerated keyword anonymous was used. See CORS settings attributes for additional information.
This attribute is used to disable a link relationship. In conjunction with scripting, this attribute could be used to turn on and off various style sheet relationships.

Note: While there is no disabled attribute in the HTML standard, there is a disabled attribute on the HTMLLinkElement DOM object.

The use of disabled as an HTML attribute is non-standard and only used by some browsers (W3 #27677). Do not use it. To achieve a similar effect, use one of the following techniques:

  • If the disabled attribute has been added directly to the element on the page, do not include the <link> element instead;
  • Set the disabled property of the StyleSheet DOM object via scripting.
This attribute specifies the URL of the linked resource. A URL might be absolute or relative.
This attribute indicates the language of the linked resource. It is purely advisory. Allowed values are determined by BCP47 for HTML5 and by RFC1766 for HTML 4. Use this attribute only if the href attribute is present.
This attribute specifies the media which the linked resource applies to. Its value must be a media query. This attribute is mainly useful when linking to external stylesheets by allowing the user agent to pick the best adapted one for the device it runs on.
Usage note:
  • In HTML 4, this can only be a simple white-space-separated list of media description literals, i.e., media types and groups, where defined and allowed as values for this attribute, such as print, screen, aural, braille. HTML5 extended this to any kind of media queries, which are a superset of the allowed values of HTML 4.
  • Browsers not supporting the CSS3 Media Queries won't necessarily recognize the adequate link; do not forget to set fallback links, the restricted set of media queries defined in HTML 4.
The value of this attribute provides information about the functions that might be performed on an object. The values generally are given by the HTTP protocol when it is used, but it might (for similar reasons as for the title attribute) be useful to include advisory information in advance in the link. For example, the browser might choose a different rendering of a link as a function of the methods specified; something that is searchable might get a different icon, or an outside link might render with an indication of leaving the current site. This attribute is not well understood nor supported, even by the defining browser, Internet Explorer 4. See Methods Property (MSDN).
This attribute names a relationship of the linked document to the current document. The attribute must be a space-separated list of the link types values. The most common use of this attribute is to specify a link to an external style sheet: the rel attribute is set to stylesheet, and the href attribute is set to the URL of an external style sheet to format the page. WebTV also supports the use of the value next for rel to preload the next page in a document series.
The value of this attribute shows the relationship of the current document to the linked document, as defined by the href attribute. The attribute thus defines the reverse relationship compared to the value of the rel attribute. Link types values for the attribute are similar to the possible values for rel.
Usage note: This attribute is obsolete in HTML5. Do not use it. To achieve its effect, use the rel attribute with the opposite link types values, e.g. made should be replaced by author. Also this attribute doesn't mean revision and must not be used with a version number, which is unfortunately the case on numerous sites.
sizes HTML5
This attribute defines the sizes of the icons for visual media contained in the resource. It must be present only if the rel contains the icon link types value. It may have the following values:
  • any, meaning that the icon can be scaled to any size as it is in a vectorial format, like image/svg+xml.
  • a white-space separated list of sizes, each in the format <width in pixels>x<height in pixels> or <width in pixels>X<height in pixels>. Each of these sizes must be contained in the resource.
Usage note:
  • Most icon format are only able to store one single icon; therefore most of the time the sizes contains only one entry. Among the major browsers, only the Apple's ICNS format allows the storage of multiple icons, and this format is only supported in WebKit.
  • Apple's iOS does not support this attribute, hence Apple's iPhone and iPad use special, non-standard link types values to define icon to be used as Web Clip or start-up placeholder: apple-touch-icon and apple-touch-startup-icon.
Defines the frame or window name that has the defined linking relationship or that will show the rendering of any linked resource.
This attribute is used to define the type of the content linked to. The value of the attribute should be a MIME type such as text/html, text/css, and so on. The common use of this attribute is to define the type of style sheet linked and the most common current value is text/css, which indicates a Cascading Style Sheet format.


Including a stylesheet

To include a stylesheet in a page, use the following syntax:

<link href="style.css" rel="stylesheet">

Providing alternative stylesheets

You can also specify alternative style sheets.

The user can choose which style sheet to use by choosing it from the View>Page Style menu. This provides a way for users to see multiple versions of a page.

<link href="default.css" rel="stylesheet" title="Default Style">
<link href="fancy.css" rel="alternate stylesheet" title="Fancy">
<link href="basic.css" rel="alternate stylesheet" title="Basic">

Stylesheet load events

You can determine when a style sheet has been loaded by watching for a load event to fire on it; similarly, you can detect if an error has occurred while processing a style sheet by watching for an error event:

function sheetLoaded() {
  // Do something interesting; the sheet has been loaded

function sheetError() {
  alert("An error occurred loading the stylesheet!");

<link rel="stylesheet" href="mystylesheet.css" onload="sheetLoaded()" onerror="sheetError()">
Note: The load event fires once the stylesheet and all of its imported content has been loaded and parsed, and immediately before the styles start being applied to the content.


  • A <link> tag can occur only in the head element; however, there can be multiple occurrences of <link>.
  • HTML 3.2 defines only the href, rel, rev, and title attributes for the link element.
  • HTML 2 defines the href, methods, rel, rev, title, and urn attributes for the <link> element. The methods and urn attributes were later removed from the specifications.
  • The HTML and XHTML specifications define event handlers for the <link> element, but it is unclear how they would be used.
  • Under XHTML 1.0, empty elements such as <link> require a trailing slash: <link />.


Specification Status Comment
HTML Living Standard
Die Definition von '<link>' in dieser Spezifikation.
Lebender Standard  
Die Definition von '<link>' in dieser Spezifikation.
HTML 4.01 Specification
Die Definition von '<link>' in dieser Spezifikation.

Browser compatibility

Wir konvertieren die Kompatibilitätsdaten in ein maschinenlesbares JSON Format. Diese Kompatibilitätstabelle liegt noch im alten Format vor, denn die darin enthaltenen Daten wurden noch nicht konvertiert. Finde heraus wie du helfen kannst!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 1.0 1.0 (1.7 oder früher) (Ja) (Ja) (Ja)
Alternative stylesheets ? 3.0 (1.9) ? (Ja) ?
disabled attribute Nicht unterstützt Nicht unterstützt (Ja) Nicht unterstützt Nicht unterstützt
methods attribute Nicht unterstützt Nicht unterstützt 4.0 Nicht unterstützt Nicht unterstützt
sizes attribute Nicht unterstützt Nicht unterstützt Bug 441770 Nicht unterstützt Nicht unterstützt Nicht unterstützt
load and error events

19 (Webkit: 535.23)

(WebKit Bug 38995)

9.0 (9.0) ? 11.60 ?
crossorigin attribute 25 18.0 (18.0) ? 15 ?
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Ja) 1.0 (1.0) (Ja) (Ja) (Ja)
Alternative stylesheets ? 4.0 (2.0) ? ? ?
disabled attribute Nicht unterstützt Nicht unterstützt ? Nicht unterstützt Nicht unterstützt
methods attribute Nicht unterstützt Nicht unterstützt 4.0 Nicht unterstützt Nicht unterstützt
sizes attribute Nicht unterstützt Nicht unterstützt Bug 441770 Nicht unterstützt Nicht unterstützt Nicht unterstützt
load and error events ? 9.0 (9.0) ? ? ?
crossorigin ? 18.0 (18.0) ? ? ?

See also

Schlagwörter des Dokuments und Mitwirkende

Mitwirkende an dieser Seite: Sebastianz, Rudi3
Zuletzt aktualisiert von: Sebastianz,