HTML 5 <link> tag
Definition and Usage
This element defines the relationship between two linked documents.
Differences Between HTML 4.01 and HTML 5
Some HTML 4.01 attributes are no longer supported.
Tips and Notes
Note: The link element is an empty element, it contains attributes
only.
Note: This element goes only in the head section, but it can appear any number of times.
Example
| How to use the <link> tag to link to an external style sheet:
<head>
<link rel="stylesheet" type="text/css" href="theme.css"
/>
</head>
|
Attributes
- 4: indicates if the attribute is defined in HTML 4.01
- 5: indicates if the attribute is defined in HTML 5
| Attribute |
Value |
Description |
4 |
5 |
| charset |
charset |
Defines the character encoding of the target URL. Default
value is "ISO-8859-1". Not supported |
4 |
|
| href |
URL |
The target URL of the resource |
4 |
5 |
| hreflang |
language_code |
Defines the base language of the target URL |
4 |
5 |
| media |
screen
tty
tv
projection
handheld
print
braille
aural
all |
Specifies on what device the document will be displayed
| screen |
For non-paged computer screens |
| tty |
For media using a fixed-pitch character grid (like teletypes, terminals, or devices with limited display
capabilities) |
| tv |
For TV-type devices (low resolution,
limited scrollability) |
| projection |
For projectors |
| handheld |
For handheld devices (small screen, limited
bandwidth) |
| print |
For paged and for documents
viewed on screen in print preview mode |
| braille |
For braille tactile feedback devices |
| aural |
For speech synthesizers |
| all |
For all devices |
|
4 |
5 |
| rel |
alternate
appendix
bookmark
chapter
contents
copyright
glossary
help
home
index
next
prev
section
start
stylesheet
subsection |
Defines the relationship between the current document and
the targeted
document |
4 |
5 |
| rev |
alternate
appendix
bookmark
chapter
contents
copyright
glossary
help
home
index
next
prev
section
start
stylesheet
subsection |
Defines the relationship between the targeted document and
the current document |
4 |
|
| target |
_blank
_self
_top
_parent |
Where to open the target URL.
- _blank - the target URL will open in a new window
- _self - the target URL will open in the same frame as it was clicked
- _parent - the target URL will open in the parent frameset
- _top - the target URL will open in the full body of the window
|
4 |
|
| type |
MIME_type like:
text/css
text/javascript
image/gif |
Specifies the MIME type of the target URL |
4 |
5 |
Standard Attributes
| class, contenteditable, contextmenu, dir, draggable, id,
irrelevant, lang, ref, registrationmark, tabindex, template, title |
For a full description, go to Standard
Attributes in HTML 5.
Event Attributes
| onabort, onbeforeunload, onblur, onchange, onclick,
oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave,
ondragover, ondragstart, ondrop, onerror, onfocus, onkeydown, onkeypress,
onkeyup, onload, onmessage, onmousedown, onmousemove,
onmouseover, onmouseout, onmouseup, onmousewheel, onresize, onscroll, onselect,
onsubmit, onunload |
For a full description, go to Event Attributes
in HTML 5.
Try-It-Yourself Demos
Link to an external style sheet
How to use the <link> tag to link to an external style
sheet.
|