Tag HTML <link>


Exemplo

Link para uma folha de estilo externa:

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

Definição e uso

A <link>tag define a relação entre o documento atual e um recurso externo.

A <link>tag é usada com mais frequência para vincular a folhas de estilo externas ou para adicionar um favicon ao seu site.

O <link>elemento é um elemento vazio, contém apenas atributos.


Suporte ao navegador

Element
<link> Yes Yes Yes Yes Yes


Atributos

Attribute Value Description
crossorigin anonymous
use-credentials
Specifies how the element handles cross-origin requests
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
referrerpolicy no-referrer
no-referrer-when-downgrade
origin
origin-when-cross-origin
unsafe-url
Specifies which referrer to use when fetching the resource
rel alternate
author
dns-prefetch
help
icon
license
next
pingback
preconnect
prefetch
preload
prerender
prev
search
stylesheet
Required. Specifies the relationship between the current document and the linked document
sizes HeightxWidth
any
Specifies the size of the linked resource. Only for rel="icon"
title   Defines a preferred or an alternate stylesheet
type media_type Specifies the media type of the linked document

Atributos Globais

A <link>tag também suporta os Atributos Globais em HTML .


Atributos do evento

A <link>tag também suporta os atributos de evento em HTML .


Páginas relacionadas

Tutorial HTML: Estilos HTML

Referência HTML DOM: Link Object


Configurações padrão de CSS

A maioria dos navegadores exibirá o <link>elemento com os seguintes valores padrão:

link {
  display: none;
}