<link>

DocumentSelf-closing

Defines relationships between the current document and external resources, most commonly used for stylesheets, favicons, and preloading.

Common Attributes

relhreftypemediasizescrossorigin

Example

<link rel="stylesheet" href="/styles.css">
<link rel="icon" href="/favicon.ico">

About the <link> Element

The <link> HTML element belongs to the Document category of HTML elements. Defines relationships between the current document and external resources, most commonly used for stylesheets, favicons, and preloading. Understanding when and how to use this element is essential for building well-structured, accessible, and SEO-friendly web pages.

As a void (self-closing) element, <link> does not have a closing tag. It is written as <link> or <link /> in XHTML syntax. This element is part of the current HTML Living Standard and is supported in all modern browsers including Chrome, Firefox, Safari, and Edge.

Proper use of semantic HTML elements like <link> improves document structure, helps screen readers interpret content correctly, and provides signals to search engines about the purpose of different sections of your page. This leads to better accessibility scores, improved SEO rankings, and more maintainable code.

Related Elements