1. Cascading Style Sheet2. ๋ฉ๋ชจ์ฅ์ด๋ ํฌ๋กฌ์์ ๋ฐ๋ก ์์ฑํ๋ ์์ 2.1. ์ธ๋ผ์ธ ๋ฐฉ์2.2. ๋ด๋ถ ์คํ์ผ ์ํธ2.3. ์ธ๋ถ ์คํ์ผ ์ํธ
1. Cascading Style Sheet
Cascading์ ๊ณ๋จ์, ์์๋๋ก ํ๋ฅธ๋ค๋ ์๋ฏธ์
๋๋ค. Style Sheet์ ๊ธ๊ผด์ ํฌ๊ธฐ, ๋ชจ์, ์ปฌ๋ฌ, ๋ฌธ๋จ ์ค์ ๋ฑ ๋ฏธ๋ฆฌ ์ ์ํด ์คํ์ผ๋ก ๋ง๋ค์๋ค๊ฐ ์น ๋ฌธ์์ ๋ณธ๋ฌธ์์ ๊ทธ ์คํ์ผ์ ์ฐธ์กฐํ์ฌ ์ฌ์ฉํ๋ ๊ธฐ๋ฅ์ ๋งํฉ๋๋ค.
๋ฐ๋ผ์, CSS ํ์ผ์ ๋ฐ๋ผ ์์ ํ ๋ค๋ฅธ ์น ์ฌ์ดํธ์ฒ๋ผ ๊พธ๋ฐ ์ ์์ต๋๋ค.
ย
HTML์ด ์น์ ๋ผ๋๋ผ๊ณ ํ๋ค๋ฉด CSS๋ HTML์ ๊พธ๋ฉฐ์ฃผ๋ ์ด์ ํด๋นํฉ๋๋ค.
ย
ย
ย
ย
2. ๋ฉ๋ชจ์ฅ์ด๋ ํฌ๋กฌ์์ ๋ฐ๋ก ์์ฑํ๋ ์์
๋ฉ๋ชจ์ฅ์์ ์๋ ์ฝ๋๋ฅผ ์
๋ ฅํ ๋ค, '๋ค๋ฅธ ์ด๋ฆ์ผ๋ก ์ ์ฅ'์ ํด๋ฆญํด ํ์ฅ์๋ฅผ
.txt
๋์ .html
๋ก ๋ฐ๊ฟ์ ์ ์ฅํ๋ฉด ๋ฉ๋๋ค.Mac OS์ ๊ฒฝ์ฐ์๋ "ํ
์คํธ ํธ์ง๊ธฐ"์์ "ํฌ๋งท"๋์ ๋ค์ด๊ฐ "์ผ๋ฐ ํ
์คํธ ๋ง๋ค๊ธฐ"์์ ์์ฑํ์ ํ ํ์ฅ์๋ฅผ
.css
๋ก ๋ณ๊ฒฝํ์๋ฉด ๋ฉ๋๋ค.2.1. ์ธ๋ผ์ธ ๋ฐฉ์
<!DOCTYPE html> <html lang="ko"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> <h1 style='red'; background-color:yellow;>Hello world</h1> </body> </html>
ย
2.2. ๋ด๋ถ ์คํ์ผ ์ํธ
<!DOCTYPE html> <html lang="ko"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style media="screen"> h1 { style='red'; background-color:yellow; } </style> </head> <body> <h1>Hello world</h1> </body> </html>
ย
2.3. ์ธ๋ถ ์คํ์ผ ์ํธ
์ธ๋ถ ์คํ์ผ ์ํธ์ ๊ฒฝ์ฐ์๋ ํ์ผ์ ๊ฒฝ๋ก (href)๋ฅผ ๋ง์ถฐ์ฃผ๊ธฐ ์ํด html ํ์ผ๊ณผ css ํ์ผ์ด ๊ฐ์ ํด๋์ ์์นํด์ผ ํฉ๋๋ค. css ํ์ผ์ ๊ฒฝ์ฐ์๋ ๋ฉ๋ชจ์ฅ์์ ์์ฑํ ์ ์์ผ๋ฉฐ, html ํ์ผ ์ ์ฅํ ๋์ ๋ง์ฐฌ๊ฐ์ง๋ก ํ์ฅ์๋ฅผ
.css
๋ก ๋ฐ๊ฟ์ฃผ๋ฉด ๋ฉ๋๋ค.<!DOCTYPE html> <html lang="ko"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <link rel="stylesheet" href="1.css"> </head> <body> <h1>Hello world</h1> </body> </html>
ย
ํ์ผ๋ช
:
1.css
h1{ color: red' background-color: yellow; }
ย
์ด๋ค ๋ฐฉ์์ด๋ ๊ฒฐ๊ณผ ํ๋ฉด์ ์ด์ ๊ฐ์ด ๋์ต๋๋ค.
ย