HTML link relation types
The rel attribute on <link> declares the relationship between the document
and a linked resource — from loading stylesheets and preloading assets to
declaring canonical URLs and icons. This searchable reference lists the common
rel values, what each does and the attributes they pair with.
How it works
A <link> element in the <head> connects the page to an external resource;
rel names the kind of relationship and the browser acts accordingly:
<link rel="stylesheet" href="/main.css" />
<link rel="preload" href="/font.woff2" as="font" type="font/woff2" crossorigin />
<link rel="modulepreload" href="/app.js" />
<link rel="preconnect" href="https://cdn.example.com" />
<link rel="canonical" href="https://example.com/page" />
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
Resource-hint relations (preload, preconnect, dns-prefetch, prefetch,
modulepreload) shape the loading priority and timing; semantic relations
(canonical, alternate, manifest, icon, author) describe the page. The
attribute is a space-separated list, so multiple relations can combine.
Tips and notes
preloadrequires anasvalue or the browser may double-fetch.- Cross-origin font preloads need
crossoriginto match the actual request. - Use
alternatewithhreflangfor localized variants and withtypefor feeds. - Keep one meaningful
canonicalper page; conflicting canonicals are ignored.