Cascading Style Sheets
β μ€νμΌ λ μ΄μμ λ±μ ν΅ν΄ λ¬Έμλ₯Ό νμνλ λ°©λ²μ μ§μ νλ μΈμ΄
β μΈλΌμΈ
<h1 style="color: blue; font-size: 100px;">HELLO</h1>
β λ΄λΆ μ°Έμ‘° -
<head>
<style>
h1 {
color: blue; -> μ μΈ
font-size: 15px; -> μμ±:κ°
}
</style>
</head>
β μΈλΆμ°Έμ‘°(link file)
<head>
<title></title>
<link rel="stylesheet" href="mystyle.css">
</head>
mystyle.css => μμ <style>h1{}</style> λ΄μ© κ°μ΄ μμ±
γ΄> HTML λ¬Έμμμ νΉμ ν μμλ₯Ό μ ννμ¬ μ€νμΌλ§ νκΈ° μν΄μλ λ°λμ μ νμκ° νμ
κΈ°λ³Έ μ νμ
κ²°ν©μ
μμ¬ ν΄λμ€/ μμ
<style>
μ 체 μ νμ
{
color: red;
}
μμ μ νμ :
h2 {
color: orange;
}
h3,h4{ font-size: 10px;
}
</style>
<style>
ν΄λμ€ μ νμ
.green {
color: green;
}
id μ νμ
#purple {
color: purple;
}
μμ κ²°ν©μ
.box > p {
font-size: 30px;
}
μμ κ²°ν©μ
.box p {
color: blue;
}
</style>
!important β> μΈλΌμΈ > idμ νμ > class μ νμ > μμ μ νμ
CSSλ μμμ ν΅ν΄ λΆλͺ¨ μμμ μμ±μ μμμκ² μμνλ€
font color text-align ν μ€νΈ κ΄λ ¨ μμ.
width height .. λ°μ€ λͺ¨λΈ μμ ν¬μ§μ κ΄λ ¨ μμ
μμμ μν₯μ λ°μ
μμμ μ§μ λ μ¬μ΄μ¦μ μλμ μΈ μ¬μ΄μ¦λ₯Ό κ°μ§λ€.
μμμ μν₯μ λ°μ§ μμ
μ΅μμ μμ(html)μ μ¬μ΄μ¦λ₯Ό κΈ°μ€μΌλ‘ λ°°μ λ¨μλ₯Ό κ°μ§λ€.
<a class="em">
<class="em">
<class="rem">
</a>
μ μ μκ² λ°λ‘ 보μ΄κ² λλ μΉ μ»¨ν μΈ μ μμ
div span {
color : red;
}
div μ span λ§ λΉ¨κ°μ
div > span {
color : red;}
div μ λ°λ‘ λ°μ span λ§ λΉ¨κ°
p ~ span { color : red;}
p νκ·Έ λ°μ λͺ¨λ span μ΄ λΉ¨κ°
p + span { color : red;}
p νκ·Έ λ°λ‘ λ€μ spanμ΄ λΉ¨κ°