XML technologies / HTML & XHTML / Alphabetical list of HTML and XHTML elements / link

(Excerpt from "HTML & XHTML ─ kurz & gut" by Jennifer Niederst Robbins)

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

   

link

HTML 4.01 | HTML 5

HTML: <link>; XHTML: <link/> or <link />

Defines a relationship between the current document and another document. Although it can define relationships such as index, next (next document) and previous (previous document), it is most often used to include an external stylesheet in the document.

Start/end tag

This is an empty element. HTML forbids an end tag. In XHTML, the element must end with a slash before the closing angle bracket. Developers can insert a space before the slash to improve backward compatibility with older browsers.

Attributes

Core, internationalization, events, global HTML 5 attributes

  • charset="Zeichenkodierung"

    Not available in HTML 5. Specifies the linked document’s character encoding.

  • href="URL"

    Contains the address of the linked or included document.

  • hreflang="Sprachcode"

    Specifies the linked document’s primary language.

  • media="all|screen|print|handheld|projection|tty|tv|projection|braille|aural"

    Specifies the media type for which the included resource should be used. It is most often used to define stylesheets for particular output media, such as screens, handheld devices and projectors.

  • rel="Linktyp-Schlüsselwort"

    Describes one or more relationships between the current and linked documents. Link types valid in both HTML 4.01 and HTML 5 are: alternate, help, index, next, prev and stylesheet. The following are valid only in HTML 4.01: appendix, chapter, contents, copyright, glossary, section, start and subsection. The following link types are valid only in HTML 5: archives, author, first, icon, last, license, pingback, prefetch, search, sidebar, tag and up.

  • rev="Beziehung(en)"

    Not available in HTML 5. Defines one or more relationships from the linked or included document back to the source document (the reverse of the attribute rel).

  • sizes="any|zwei Pixelwerte"

    HTML 5 only. Size information when link has the value icon.

  • target ="Name"

    Not available in HTML 5. Defines the default target window for all links in the document. Often used to specify a target frame.

  • title="Name"

    HTML 5 only. Contains the linked resource’s title.

  • type="Ressource"

    Indicates a resource’s media or content type. The value text/css indicates an external stylesheet (CSS).

Example (HTML)

<head>
<link rel="stylesheet" href="/pfad/zum/stylesheet.css "type="text/css">
</head>

Example (XHTML)

<head>
<link rel="stylesheet" href="/pfad/zum/stylesheet.css "type="text/css" />
</head>

 

> back to the alphabetical list of elements

   

 

 

 

back to top