HTML <head> 태그
예시
head 섹션 안에 <title> 태그가 있는 간단한 HTML 문서:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Title of the document</title>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a
paragraph.</p>
</body>
</html>
아래에서 더 많은 "직접 사용해 보기" 예를 살펴보세요.
정의 및 사용
<head>
요소는 메타데이터(데이터에 대한 데이터)의 컨테이너이며 <html> 태그와 <body> 태그 사이에 배치됩니다 .
메타데이터는 HTML 문서에 대한 데이터입니다. 메타데이터는 표시되지 않습니다.
메타데이터는 일반적으로 문서 제목, 문자 집합, 스타일, 스크립트 및 기타 메타 정보를 정의합니다.
다음 요소는 <head>
요소 내부에 들어갈 수 있습니다.
브라우저 지원
Element | |||||
---|---|---|---|---|---|
<head> | Yes | Yes | Yes | Yes | Yes |
전역 속성
<head>
태그는 HTML의 전역 속성도 지원 합니다 .
더 많은 예
예시
< base> 태그(페이지의 모든 링크에 대한 기본 URL 및 대상 지정)는 <head> 내부로 이동합니다.
<html>
<head>
<base href="https://www.w3schools.com/" target="_blank">
</head>
<body>
<img src="images/stickman.gif" width="24"
height="39" alt="Stickman">
<a href="tags/tag_base.asp">HTML base Tag</a>
</body>
</html>
예시
< style> 태그(페이지에 스타일 정보 추가)는 <head> 내부에 들어갑니다.
<html>
<head>
<style>
h1 {color:red;}
p {color:blue;}
</style>
</head>
<body>
<h1>A heading</h1>
<p>A
paragraph.</p>
</body>
</html>
예시
< link> 태그(외부 스타일 시트에 대한 링크)는 <head> 내부에 있습니다.
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<h1>I am formatted with a linked style sheet</h1>
<p>Me too!</p>
</body>
</html>
관련 페이지
HTML 튜토리얼: HTML 헤드
HTML DOM 참조: 헤드 개체
기본 CSS 설정
대부분의 브라우저는 <head>
다음 기본값으로 요소를 표시합니다.
head {
display: none;
}