HTML link Tag

HTML<link>Tag: The HTML<link> tag specifies a link between the document and an external source. And the  external style sheets are linked by <link> tag. While the <link>element belongs to Metadata content category.



HTML<link>Tag

This HTML link tag supports both the global and the event attributes.

Syntax:<link rel=”stylesheet” type=”text/css” href=”filename”>

Browser compatibility

The HTML<link>tag is supported by different types of browsers.

  • Chrome
  • Firefox
  • Opera
  • Safari
  • Internet Explorer

Example:

<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<h1>FRESHERSNOW TUTORIAL</h1>
</body>
</html>

Output:

HTML link tag

Attributes that are supported by the <link> tag

Attribute Value Description
charset char_encoding 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
author
dns-prefetch
help
icon
license
next
pingback
preconnect
prefetch
preload
prerender
prev
search
stylesheet
Specifies the relationship between the current document and the linked document
rev reversed relationship Describes the relationship between the linked document and the current document
target _blank
_self
_top
_parent
frame_name
Describes where the linked document is to be loaded
type media_type Specifies the media type of the linked document