HTML Link Tag



The HTML <link> tag is used for relationship between the current Document and an external Document.

The Link tag is also used to link an external css stylesheet.

it's also used to add favicons.

HTML Link Tag Syntax

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

Example

<!DOCTYPE html>
    <html lang="en">
    <head>
        <title>Example of HTML link tag</title>
        <link rel="stylesheet" href="cssfile.css">
    </head>
    <body>
        <h1>Linking External Style Sheet</h1>
        <p>The styles of this HTML document are defined in linked style sheet.</p>
    </body>
    </html> 
    


Click on the "Run This Code" button to see how it works.


HTML Link Tag Attributes

Attribute Value Description
charset charset it defines how the tag handles cross-origin requests.
href url it defines the URL of the resource document.
hreflang language it defines Language code of the destination URL
media screen tty tv projection handheld print braille aural it defines the device the document will be displayed on.
rel home index next prev section start stylesheet subsection alternate appendix bookmark chapter contents copyright glossary help it defines the relationship between the current document and the destination URL.
type mimetype it defines MIMEtype of content at the link destination.
target blank _self _top _parent it defines the target frame to load the page into.
sizes Height & Width it defines the size of the linked resource.
rev home index next prev section start stylesheet subsection alternate appendix bookmark chapter contents copyright glossary help it defines a reverse between the destination URI and the current document.




HTML

Welcome HTML Getting Started HTML Elements HTML Attributes HTML Headings HTML Paragraphs HTML Links HTML Styles HTML Text Formatting HTML Tables HTML Images HTML Forms HTML Lists HTML Iframes HTML Comments HTML CSS HTML Colors HTML Classes HTML Id HTML javascript HTML Filepaths

HTML Advanced

HTML Doctypes HTML Validation HTML Validation HTML URL HTML URL Encode HTML URL Entities HTML Layout HTML Head HTML Meta HTML Scripts HTML Tags

HTML Media

HTML Media HTML Audio HTML Video HTML Plug-ins HTML Youtube

HTML Graphics

HTML Canvas HTML SVG