Name
link — HTML 4.01 | HTML5
Synopsis
HTML: <link>; XHTML: <link/> or <link />
Defines the relationship between the current document and another document. Although it can signify such relationships as index, next, and previous, it is most often used to link a document to an external style sheet.
Start/End Tags
This is an empty element. In HTML, the end tag is forbidden. In XHTML, the element must be closed with a trailing slash as just shown. Developers may include a space character before the slash for backward compatibility with older browsers.
Attributes
Core, Internationalization, Events, HTML5 Global Attributes
charset="
charset
"
Not in HTML5. Specifies the character encoding of the linked document.
href="
URL
"
Identifies the linked document.
hreflang="
language code
"
Specifies the base language of the linked document.
media="all|screen|print|handheld|projection|tty|tv|projection|braille|aural"
Identifies the media to which the linked resource applies. Most often, it is used to assign style sheets to their appropriate media.
rel="
link type keyword
"
Describes one or more relationships from the current source document to the linked document. The link types specified in both the HTML 4.01 and 5 specifications are
alternate
,help
,index
,next
,prev
, andstylesheet
. The HTML 4.01-only keywords includeappendix
,chapter
,contents
,copyright
,glossary
,section
,start
, andsubsection
. The following link types are specified in HTML5 only:archives
,author
,first
,icon
,last
,license
,pingback
,prefetch ...
Get HTML & XHTML Pocket Reference, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.