HTML Link Element

The HTML link element is used to set relationships of other documents with this document. For example a style sheet that is used to control element style (as in the above example) may be defined with this element. HTML link element attributes include:

  • CHARSET - The character encoding of the link. An example is "ISO-8859-1".
  • HREF - The location and name of the resource.
  • HREFLANG - Describes the expected language. An example value is "en" for English.
  • MEDIA - Describes the type of display the content is designed for. Possible values include all, aural, braille, handheld, projection, print, screen, tty, and tv. Screen is the default media value.
  • REL - Relationship to the linked resource.
  • REV - Relationship from the linked resource to the document. Possible values of REL and REV include alternate, appendix, stylesheet, bookmark, chapter, contents, copyright, glossary, help, index, next, prev, start, section, and subsection. The value "made" supported by HTML 3.2 is not supported by HTML 4.0.
  • TYPE - Describes the expected content of the resource the link points to. Typical values include application/java, text/html, text/css, image/jpeg, and text/javascript.

An additional attribute allowed by the HTML 4.0 transitional standard is:

  • TARGET - Specifies the frame target the referenced page will be put into. The target may me a named window or one of the special reserved names below. If the target is a named window that exists the web page the link points to will be loaded into that window. If a window by that name does not exist, a new window with that name will be created.
    • _blank - The web linked page loads in a new window and does not name the window.
    • _parent - The new page will load in the parent frame or window.
    • _self - The new page will load in the same window that the link is in. If the link is in a frame, it will load inside the frame. This is the default target.
    • _top - The new page will load into the top window reguardless of how many framesets deep the link is embedded.

An example used to specify an external style sheet:

<link href="style.css" rel="stylesheet" type="text/css">