Web/HTML

4. HTML 문서 만들기 | html, head, title, body, doctype

성니 2021. 1. 12. 22:14

/* 윈도우 10에서 Atom 편집기를 사용했습니다. */

 

<html>
<head>
 <title>...</title>
</head>
<body> </body>
</html>

HTML 문서를 만들 때는 위의 코드 양식을 따른다.

 

 

HTML 문서 양식

 

<html>...</html> : html을 사용한 문서임을 알리고, html의 시작과 끝을 알림

<head>...</head> : 본문에 해당되지 않는 태그(문서를 설명하는 태그)를 담는 공간 

<body>...</body> : 본문을 담는 공간

 

 

 

<html>
<head>
  <title>HTML - About Penguins</title> // 문서의 제목
  <meta charset="utf-8"> // 문서를 저장한 문자 방법
</head>
<body>
<h1>Penguins</h1>
<ul>
  <li>King Penguin Aptenodytes patagonicus</li>
  <li>Emperor Penguin Aptenodytes forsteri</li>
  <li>Gentoo Penguin Pygoscelis papua</li>
  <li>Adelie Penguin Pygoscelis adeliae</li>
  <li>Chinstrap Penguin Pygoscelis antarcticus</li>
  <li>Southern Rockhopper Penguin Eudyptes chrysocome</li>
  <li>Northern Rockhopper Penguin Eudyptes moseleyi</li>
  <li>Fiordland Penguin Eudyptes pachyrhynchus</li>
  <li>Snares Penguin Eudyptes robustus</li>
  <li>Erect-crested Penguin Eudyptes sclateri</li>
  <li>Macaroni Penguin Eudyptes chrysolophus</li>
  <li>Royal Penguin Eudyptes schlegeli</li>
  <li>Yellow-eyed Penguin Megadyptes antipodes</li>
  <li>Little Penguin Eudyptula minor</li>
  <li>African Penguin Spheniscus demersus</li>
  <li>Humboldt Penguin Spheniscus humboldti</li>
  <li>Magellanic Penguin Spheniscus magellanicus</li>
  <li>Galapagos Penguin Spheniscus mendiculu</li>
</ul>
</body>
</html>

HTML 문서 양식에 따라 만들어본 펭귄 종에 관한 자료.

 

 

 

코드 실행 결과

 

 

 

DOCTYPE(Document type delcaration)

Document Type, 즉 문서의 형식을 나타내는 역할을 한다.

자신이 작성한 HTML 코드가 어떤 방식을 따랐는지 웹브라우저에게 알린다.

 

 

<!DOCTYPE html>

HTML 문서의 제일 앞에 위의 코드를 추가해주자

 

 

 

HTML 5에 접어들면서 DOCTYPE은 위의 코드로 통일되었다.

이전에 사용되었던 DOCTYPE에 대해서 알고 싶으면 아래 링크를 참고하자.

 

https://www.w3schools.com/tags/tag_doctype.asp

 

HTML doctype declaration

HTML Declaration ExampleThe content of the document...... Try it Yourself » Definition and Usage All HTML documents must start with a declaration. The decla

www.w3schools.com

 

728x90