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 참조: 링크 개체


기본 CSS 설정

대부분의 브라우저는 <link>다음 기본값으로 요소를 표시합니다.

link {
  display: none;
}