HTML - тег <ссылка>


Пример

Ссылка на внешнюю таблицу стилей:

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

Определение и использование

Тег <link>определяет связь между текущим документом и внешним ресурсом.

Тег <link>чаще всего используется для ссылки на внешние таблицы стилей или для добавления фавикона на ваш сайт.

Элемент <link>является пустым элементом, он содержит только атрибуты.


Поддержка браузера

Element
<link> Yes Yes Yes Yes Yes


Атрибуты

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

Глобальные атрибуты

Тег <link>также поддерживает глобальные атрибуты в HTML .


Атрибуты события

Тег <link>также поддерживает атрибуты событий в HTML .


Связанные страницы

Учебное пособие по HTML: стили HTML

Справочник по HTML DOM: объект Link


Настройки CSS по умолчанию

Большинство браузеров будут отображать <link>элемент со следующими значениями по умолчанию:

link {
  display: none;
}