HTML link element

HTML <link> tag links the current document to the other resources. These resources may be CSS sytylesheet or javascript file.

  <link rel="stylesheet" href="files/test.css" />

We write the URL or address of the external document in the href attribute of link element. link element is usually written inside head element.

Tag omission

It is a self-closing tag (<link />) i.e. there is no end tag.

Global Attributes

All the global attributes are applicable on the link element.

Tag Attributes

Attributes that are applicable to <link> tag

The address of the linked resource.

<link href="address of external resource">

relation of the current document to the external document.

<link href="design.css" rel="stylesheet">

Type of media to which the external resource applies.

<link href="design.css" media="print">

The language of the external document. It may be Js or CSS file.

<link href="design.css" hreflang="en">

Tells about the type of external resource.

<link href="design.css" type="text/css">

Sizes of the icons that appear in the tab bar.

<link href="" size="50x50">

Was this article helpful?