.html
<!DOCTYPE html>
<html lang="ko-KR">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My test page</title>
</head>
<body>
<img src="images/firefox-icon.png" alt="My test image">
<script src="./script.js"></script>
</body>
</html>
<!DOCTYPE html>
Living Standard
를 HTML의 유일한 버전으로 발표했다.<!DOCTYPE html>
작성 시,참고) 마크업 검사 사이트
https://validator.w3.org/
validate by Direct Input
에 자신이 작성한 코드를 검사할 수 있다.
(* 모든 브라우저에서 작동이 되는지, 오류없는지 알 수 있는 유용한 사이트)
<html lang="">
예시) ko(언어코드)-KR(국가코드), en(영어)-US(미국), zh(중국어)-CN(중국)
<head>
<meta>
<meta charset="utf-8">
utf-8
은 국제적인 코드 규약으로 어떤 언어로 작성해도 웹페이지를 읽게 해준다.<meta http-equiv="X-UA-Compatible" content="IE=edge" />
IE의 최신 표준 모드
를 보여준다.<meta name="viewport" content="width=device-width, initial-scale=1.0" />
name
은 이름, content
는 값 으로 문서의 메타데이터를 이름-값 쌍으로 제공한다.name
: 면 전체 페이지에 적용되는 "문서 레벨 메타데이터" 제공하고, 어떤 형태의 정보(viewport, description, author 등)를 가지고 있는지 의미한다.content
: 실제 메타데이터의 요소이다.
name="viewport"
인 경우content
값
width
: 뷰포트의 너비를 제어한다. (*픽셀값으로도 지정할 수 있다.)height
: 뷰포트의 높이를 제어한다.initial-scale
: 페이지가 처음 로드 될 때 확대/축소 수준을 제어한다. 최소 0.1 - 기본 1 - 최대 10minimum-scale
: 축소 정도를 제어한다.maximum-scale
: 페이지에 허용되는 확대 정도를 제어한다. 3보다 작은 값은 접근성에 맞지 않는다.user-scalable=no
과 속성을 주어 사용자가 화면크기를 제어 못하게 하는 경우도 있다. 하지만, 다양한 디바이스 크기, 노안, 저시력 등의 다양한 상황때문에 잘 쓰지 않는다.
(* 해당 속성을 사용해도 접근성을 위해서 무시하는 브라우저도 있다.)
<title>
<link>
head
요소 내부에만 위치 가능<html>
<head>
<!-- 스타일 시트 링크 -->
<link rel="stylesheet" href="style.css">
<!-- 폰트 링크 -->
<link rel="stylesheet" href="font.ttf">
<!-- 파비콘 링크 -->
<link rel="shortcut icon" href="favicon.ico">
</head>
<body>
</body>
</html>
rel
: relations 관계로, 대상 파일의 속성을 나타낸다.href
: hyper-references 경로로, 연결 시 참조할 파일의 위치를 나타낸다.<body>
Snippet은
snippet 스니펫
https://snippet-generator.app/
(출처 자료 : 위니브)
"html": {
"prefix": "!!",
"body": [
"<!DOCTYPE html>",
"<html lang=\"ko-KR\">",
"<head>",
" <meta charset=\"UTF-8\">",
" <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">",
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">",
" <title>$1</title>",
"",
" <!-- CSS -->",
" <link rel=\"stylesheet\" href=\"\">",
"</head>",
"<body>",
" $2",
" <!-- JavaScript -->",
" <script src=\"\"></script>",
"</body>",
"</html>"
],
"description": "html"
}
{}
안에 위 코드를 넣으면, !!
tab키를 누르면 자동으로 html이 완성된다.