HTML link tag

## HTML Reference

HTML by Alphabet HTML by Function HTML Global Attributes HTML Events HTML Canvas HTML Audio/Video HTML Doctypes HTML Colornames HTML Colorpicker HTML Colormixer HTML Character Sets HTML ASCII HTML ISO-8859-1 HTML Symbols HTML URL Encode HTML Lang Codes HTTP Messages HTTP Methods Keyboard Shortcuts

## HTML Tags

<!--> <!DOCTYPE> <a> <abbr> <acronym> <address> <applet> <area> <article> <aside> <audio> <b> <base> <basefont> <bdi> <bdo> <big> <blockquote> <body> <br> <button> <canvas> <caption> <center> <cite> <code> <col> <colgroup> <command> <datalist> <dd> <del> <details> <dfn> <dialog> <dir> <div> <dl> <dt> <em> <embed> <fieldset> <figcaption> <figure> <font> <footer> <form> <frame> <frameset> <head> <header> <h1> - <h6> <hr> <html> <i> <iframe> <img> <input> <ins> <kbd> <keygen> <label> <legend> <li> <link> <map> <mark> <menu> <meta> <meter> <nav> <noframes> <noscript> <object> <ol> <optgroup> <option> <output> <p> <param> <pre> <progress> <q> <rp> <rt> <ruby> <s> <samp> <script> <section> <select> <small> <source> <span> <strike> <strong> <style> <sub> <summary> <sup> <table> <tbody> <td> <textarea> <tfoot> <th> <thead> <time> <title> <tr> <track> <tt> <u> <ul> <var> <video> <wbr>

# HTML <link> Tag

« HTML Reference
<map> Tag »

## Example

Link to an external style sheet:

<head>
<link rel="stylesheet" type="text/css" href="theme.css">
</head>
Try it yourself »

## Browser Support

When used for style sheets, the <link> tag is supported in all major browsers. No real support for anything else.

## 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.

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.

## Differences Between HTML 4.01 and HTML5

Some HTML 4.01 attributes are not supported in HTML5.

The "sizes" attribute is new in HTML5.

## Differences Between HTML and XHTML

In HTML the <link> tag has no end tag.

In XHTML the <link> tag must be properly closed.

## Attributes

New : New in HTML5.

Attribute | Value | Description
--- | --- | ---
charset | char_encoding | Not supported in HTML5. Specifies the character encoding of the linked document
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
license
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. Specifies the relationship between the linked document and the current document
sizes New | HeightxWidth any | Specifies the size of the linked resource. Only for rel="icon"
target | _blank _self _top _parent frame_name | Not supported in HTML5. Specifies where the linked document is to be loaded
type | MIME_type | Specifies the MIME type of the linked document

## Global Attributes

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

## Event Attributes

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

## Related Pages

HTML tutorial: HTML Styles

HTML DOM reference: Link object

« HTML Reference
<map> Tag »

## Your suggestion:

Your E-mail (optional):

Page address:

Description:

Close [X]

## Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

## WEB HOSTING

Best Web Hosting UK Reseller Hosting Wow! $5 SSD Hosting

## WEB BUILDING

Download XML Editor
FREE Website BUILDER FREE Website Creator

## WEB RESOURCES

Web Statistics Web Validation

## SHARE THIS PAGE