W3Schools.com

HTML5 <link> Tag

Example

Link to an external style sheet:

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

Try it yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The <link> tag is supported in all major browsers.


Definition and Usage

The <link> tag defines the relationship between a document and an external resource.

The <link> tag is most used to link to style sheets.


Differences Between HTML 4.01 and HTML5

Some HTML 4.01 attributes are not supported in HTML5.

The "sizes" attribute is new in HTML5.


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.


Attributes

New : New in HTML5.

Attribute Value Description
charset char_encoding Not supported in HTML5
href URL Specifies the location of the linked document
hreflang language_code Specifies the language of the text in the linked document
media media_query Specifies on what device the linked document will be displayed
rel alternate
archives
author
bookmark
external
first
help
icon
last
licence
next
nofollow
noreferrer
pingback
prefetch
prev
search
sidebar
stylesheet
tag
up
Required. Specifies the relationship between the current document and the linked document
rev reversed relationship Not supported in HTML5
sizesNew HeightxWidth
any
Specifies the size of the linked resource. Only for rel="icon"
target _blank
_self
_top
_parent
frame_name
Not supported in HTML5
type MIME_type Specifies the MIME type of the linked document

Global Attributes

The <link> tag also supports the Global Attributes in HTML5.


Event Attributes

The <link> tag also supports the Event Attributes in HTML5.


WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$7.95/mo SEO Hosting
Premium Website Design
WEB BUILDING
XML Editor - Free Trial!
FREE Website BUILDER
Free Website Templates Free CSS Templates
Make Your Own Website
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE