css가 무엇이지 이해해보자
웹사이트를 독창적으로 만들어주는 CSS!
➡️ 어떤 태그를 꾸밀것인지(선택자)와 어떻게 꾸밀지( {} )!!
h1 { color: yellow; font-size:2em; }
coloryellowcolor: yellow; 세미콜론(;)이 붙는다.{ color: yellow; font-size:2em; } 중괄호가 포함된h1 { color: yellow; font-size:2em; } 속성까지 모두 포함된/*
내용
*/
style속성에 작성<div style="color:red;"> 내용 </div>
➖ 수정이 어렵다.
<style>태그를 이용해서 셀렉터를 활용<head>태그에 작성한다. <head>
<style> div {color: red;} </style>
<head>
➖ 모든 페이지에 추가가 어렵다.
➕ html
<style>태그
- html의
<head>태그에 포함됨.
<head>태그에 작성한다.<head>
<link rel="stylesheet" href="css/style.css">
</head>
rel : 연결되는 파일이 어떤 관계인지 적어줌. CSS의 경우 stylesheethref : CSS 파일의 경로 많은 페이지에도 적용이 쉽고 수정이 간단하다.
따라서 가장 자주 쓰인다.
@import url("css/style.css");
css작성 방법중에는 External방법이 가장 자주 쓰인다.