selector{
property : value;
}
/* μμ± : κ° -> declaration */
*
λ¬Έμμ μλ λͺ¨λ μμμ λν΄ μ€νμΌ μ μ©_(μΈλλ°)
, -(νμ΄ν)
λ‘ μμνλλ‘!h1 {color: red;}
h2 {color: red;}
h3 {color: red;}
h4 {color: red;}
h5 {color: red;}
h6 {color: red;}
h1, h2, h3, h4, h5, h6 {color: red;}
/*μ νμ λͺ©λ‘μ μ΄μ©νμ¬ ν¨μ¨μ μΌλ‘ μμ±*/
<style>
p {color: red;
font-size: 20px;}
p {color: green;}
/* νμ color : green μ μ© */
</style>
<style>
p.color-red {
color: red;
font-size: 20px;
}
/* λ ꡬ체μ μΈ μ νμ, color : red; μ μ©*/
p { color: green;
}
</style>
- inline-style : μμμ μμ μμ±μΌλ‘ μ μΈλλ μ€νμΌ, 1000 μ
- id μ νμ : 100μ
- class, κ°μν΄λμ€, μμ± μ νμ : 10μ
- νμ , κ°μμμ μ νμ : 1μ
- μ 체μ νμ(Universal Selector) : 0μ
!important
@import "foo.css";
@
κ° λΆλ λ¬Έλ² at-rule
@charset
: μ€νμΌμνΈμμ μ¬μ©νλ λ¬Έμ μΈμ½λ© μ§μ . λ¬Έμμμ κ°μ₯ λ¨Όμ μ μΈ.@import
: λ€λ₯Έ μ€νμΌ μνΈμμ μ€νμΌ κ·μΉμ κ°μ Έμ΄.@charset
λ°λ‘ λ€μμ μ μΈλμ΄μΌν¨.@font-face
: λλ°μ΄μ€μ μλ ν°νΈλ₯Ό λ€μ΄λ°μ μ μ©ν λ μ¬μ©.@keyframes
: μ λλ©μ΄μ μ λ§λ€ λ μ¬μ©.@media
: μ¬μ©μ λλ°μ΄μ€μ λ°λ₯Έ μ€νμΌμ λΆκΈ° μ²λ¦¬νκ³ μ ν λ μ¬μ©.@supports
: νΉμ CSS μμ±μ λΈλΌμ°μ κ° μ§μνλμ§ νμΈνκ³ μ€νμΌμ μ μΈνκ³ μ ν λ μ¬μ©.
<!DOCTYPE html>
<html lang="ko">
<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>hello</title>
<style type="text/css">
/*
μλμ κ°μ΄ μ¬λ¬κ°μ§λ‘ μ¬μ©ν μ μμ΅λλ€.
@import url("hello.css");
@import url(hello.css);
@import url("./hello.css");
@import "hello.css"; // @import hello.css;λ μλ©λλ€.
*/
@import "hello.css";
</style>
</head>
<body>
<h1>hello world</h1>
</body>
</html>