Etiqueta <link> HTML

Definition and Usage

<link> The tag defines the relationship between the current document and an external resource.

<link> The tag is most commonly used to link to an external stylesheet or to add an icon to a website.

<link> The element is an empty element, it only contains attributes.

See also:

HTML Tutorial:HTML Styles

HTML DOM Reference Manual:Link Object

Example

Link to an external stylesheet:

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

Try it yourself

Attribute

Attribute Value Description
crossorigin
  • anonymous
  • use-credentials
Define how the element handles cross-origin requests.
href URL Define the location of the linked document.
hreflang Voice Code Define the language of the text in the linked document.
media Media Query Define on which device the linked document will be displayed.
referrerpolicy
  • no-referrer
  • no-referrer-when-downgrade
  • origin
  • origin-when-cross-origin
  • unsafe-url
Define which referer to use when accessing the resource.
rel
  • alternate
  • author
  • dns-prefetch
  • help
  • icon
  • license
  • next
  • pingback
  • preconnect
  • prefetch
  • preload
  • prerender
  • prev
  • search
  • stylesheet
Required. Define the relationship between the current document and the linked document.
sizes
  • HeightxWidth
  • any
Define the size of the linked resource. Only applicable for rel="icon".
title Define a tabela de estilos preferida ou alternativa.
type Tipo de mídia Define o tipo de mídia do documento vinculado.

Atributos globais

<link> A tag também suporta Atributos globais no HTML.

Atributos de evento

<link> A tag também suporta Atributos de evento no HTML.

Configurações CSS padrão

A maioria dos navegadores usará os seguintes valores padrão para exibir <link> Elemento:

link {
  display: none;
}

Suporte ao navegador

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Suporte Suporte Suporte Suporte Suporte