โœจ

003. CSS

1. Cascading Style Sheet

Cascading์€ ๊ณ„๋‹จ์‹, ์œ„์•„๋ž˜๋กœ ํ๋ฅธ๋‹ค๋Š” ์˜๋ฏธ์ž…๋‹ˆ๋‹ค. Style Sheet์€ ๊ธ€๊ผด์˜ ํฌ๊ธฐ, ๋ชจ์–‘, ์ปฌ๋Ÿฌ, ๋ฌธ๋‹จ ์„ค์ • ๋“ฑ ๋ฏธ๋ฆฌ ์ •์˜ํ•ด ์Šคํƒ€์ผ๋กœ ๋งŒ๋“ค์—ˆ๋‹ค๊ฐ€ ์›น ๋ฌธ์„œ์˜ ๋ณธ๋ฌธ์—์„œ ๊ทธ ์Šคํƒ€์ผ์„ ์ฐธ์กฐํ•˜์—ฌ ์‚ฌ์šฉํ•˜๋Š” ๊ธฐ๋Šฅ์„ ๋งํ•ฉ๋‹ˆ๋‹ค.
๋”ฐ๋ผ์„œ, CSS ํŒŒ์ผ์— ๋”ฐ๋ผ ์™„์ „ํžˆ ๋‹ค๋ฅธ ์›น ์‚ฌ์ดํŠธ์ฒ˜๋Ÿผ ๊พธ๋ฐ€ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
notion imagenotion image
ย 
HTML์ด ์›น์˜ ๋ผˆ๋Œ€๋ผ๊ณ  ํ•œ๋‹ค๋ฉด CSS๋Š” HTML์„ ๊พธ๋ฉฐ์ฃผ๋Š” ์‚ด์— ํ•ด๋‹นํ•ฉ๋‹ˆ๋‹ค.
ย 
ย 
Icon made byย flaticonIcon made byย flaticon
Icon made byย flaticon
ย 
notion imagenotion image
ย 

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; }
ย 
์–ด๋–ค ๋ฐฉ์‹์ด๋“  ๊ฒฐ๊ณผ ํ™”๋ฉด์€ ์ด์™€ ๊ฐ™์ด ๋‚˜์˜ต๋‹ˆ๋‹ค.
notion imagenotion image
ย