HTML link element

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

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

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
href

The address of the linked resource.

<link href="address of external resource">
media

relation of the current document to the external document.

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

Type of media to which the external resource applies.

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

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

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

Tells about the type of external resource.

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

Sizes of the icons that appear in the tab bar.

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


Was this article helpful?

 

Email:

Message: