1-2 css
[css] html문서에서 css 연결하기
vvvictory2
2021. 5. 13. 23:16

css 코드가 짧을 경우(html 문서 내에서 해결하고자 할 때)
html문서 내에서 <style></style>태그를 이용한다.
css 코드가 길 경우(css 파일을 연결하고자 할 때)
html문서에서 스크립트 파일로 저장된(별도의 파일로 저장된) css파일(.css)을 연결시키고자 할 때
html문서에서 <link>태그의 href속성, 즉 <link href>를 이용해서 css파일을 연결시킨다.
· <link rel="stylesheet" href="css파일경로">
▶예시
· <link>태그 + href속성
· <link rel="stylesheet" href="anniversary-calculator.css">
<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>aniversary calclulator</title>
<link rel="stylesheet" href="anniversary-calculator.css">
</head>
<body>
...