HTML๋ฅผ ์์๊ฒ, ๋ณด๊ธฐ ์ข๊ฒ ๊พธ๋ฉฐ์ฃผ๋ CSS๋ฅผ ์ ์ฉํ๋ ๋ฐฉ๋ฒ์ ํฌ๊ฒ 4๊ฐ์ง๊ฐ ์์ต๋๋ค.
ย
์ธ๋ถ CSS ํ์ผ ๋ก๋ํ๊ธฐ
<head> <link rel="stylesheet" href="css/foo.css"> </head>
ย
HTML์์ CSS ์์ฑํ๊ธฐ
<head> <style> body {font-size: 14px;} </style> </head>
ย
์ธ๋ผ์ธ ์คํ์ผ
<body style="font-size: 14px;">
ย
CSS ํ์ผ ์์ CSS ํฌํจํ๊ธฐ
@import "foo.css";
ย
์๋ฆญ ๋ง์ด์ด์ reset CSSย https://meyerweb.com/eric/tools/css/reset/
Normalize.cssย https://necolas.github.io/normalize.css/
๊ฐ ๋ธ๋ผ์ฐ์ ๋ค์ ์์ฒด์ ์ผ๋ก ์ ์ฉ๋์ด ์๋ ๊ธฐ๋ณธ ์คํ์ผ(์ฌ๋ฐฑ ๋ฑ)์ ์ด๊ธฐํ ์์ผ์ ์ํ๋ ๋์์ธ์ ์ ์ฉํ๊ธฐ ์ฝ๊ฒ ๋ง๋ค์ด ์ค๋๋ค. ์์ ๋๊ฐ์ง ๋ฐฉ๋ฒ์ ์ผ๋ฐ์ ์ผ๋ก ๋ง์ด ์ฌ์ฉํ๋ฉฐ, ํ๋ก์ ํธ์ ๋ง๊ฒ ์ง์ ๋ง๋ค์ด ์ฐ๊ธฐ๋ ํฉ๋๋ค.
ย
/* ์ ํ์ */ body { background-color: red; /* ์์ฑ */ /* ๊ฐ */ }
โฒ body์ background-color๋ฅผ red๋ก ์ค์
ย
/* ์ ํ์ */ header a { display: inline-block; /* ์์ฑ */ /* ๊ฐ */ }
โฒ header์ ํฌํจ๋์ด ์๋ a์ display๋ฅผ inline-block์ผ๋ก ์ค์
ย
์๋์ ๋ด์ฉ ์ธ์๋ ๋ง์ ์ ํ์๋ค์ด ์์ง๋ง, ๊ณต๋ถ๋ฅผ ์ฒ์ ์์ํ ๋ ์ฐ์ ์๋ฉด ์ข์ ๊ฒ๋ค ์์ฃผ๋ก ์ถ๋ ค๋ณด์์ต๋๋ค.
ย
*
:ย ๋ฌธ์ ๋ด์ ๋ชจ๋ ์๋ฆฌ๋จผํธ๋ฅผ ์ ํ.
body
,header
,h1
,section
๋ฑ ํด๋น ์ด๋ฆ์ ๊ฐ์ง html ์๋ฆฌ๋จผํธ๋ฅผ ์ ํ.
#foo
id ์ ํ์ :<div id="foo">
์ ํํ๋ก, id๋ ์ค๋ณต์ด ๋ถ๊ฐ๋ฅํ ์ ์ผํ ๊ฐ.
.foo
class ์ ํ์ :<div class="foo">
์ ํํ๋ก, ์ค๋ณต์ด ๊ฐ๋ฅ. class๋ก ์์ฃผ ์ฐ๋ ์คํ์ผ์ ์ ์ํด๋๊ณ ์ฌ์ฌ์ฉ.
input[type="text"]
: input ์๋ฆฌ๋จผํธ ์ค type ์์ฑ์ ๊ฐ์ดย text์ธ ์๋ฆฌ๋จผํธ๋ฅผ ์ ํ.
ย
.foo > p
: class="foo"์ธ ์๋ฆฌ๋จผํธ์ ์ง๊ณ ์์ ์๋ฆฌ๋จผํธ ์ค p๋ฅผ ์ ํ. ๋ฌธ์ ๋ด์ ๋ชจ๋ ์๋ฆฌ๋จผํธ๋ฅผ ์ ํ.ย
.foo > p ์ค๋ช
์์ code
<section class="foo"> <header> <h1>์ง์์ ๋ง์๋ ํผ์ ๋ง๋ค๊ธฐ</h1> <p>์ฃผ์์์ ์ฝ๊ฒ ๊ตฌํ ์ ์๋ ์ฌ๋ฃ๋ฅผ ์ค์ฌ์ผ๋ก</p> </header> <p>AAAAA</p> <-.foo>p </section>
ย
.foot:first-child/.foo:last-child/.foo-nth-child(n) ์ค๋ช
์์ code
<ul> <li class="foo">1</li> <!-- .foo:first-child --> <li class="foo">2</li> <li class="foo">3</li> <!-- .foo:nth-child(3) --> <li class="foo">4</li> <li class="foo">5</li> <!-- .foo:last-child --> </ul>
.foo:first-child : class="foo"์ธ ์๋ฆฌ๋จผํธ ์ค ์ฒซ๋ฒ์งธ ์์์ธ ์๋ฆฌ๋จผํธ๋ฅผ ์ ํ
.foo:last-child : class="foo"์ธ ์๋ฆฌ๋จผํธ ์ค ๋ง์ง๋ง ์์์ธ ์๋ฆฌ๋จผํธ๋ฅผ ์ ํ
.foo:nth-child(n) class="foo"์ธ ์๋ฆฌ๋จผํธ ์ค n๋ฒ์งธ ์์์ธ ์๋ฆฌ๋จผํธ๋ฅผ ์ ํ
ย

box-sizing: content-box (๊ธฐ๋ณธ๊ฐ)
width: 300px; height: 200px; padding: 20px; border: 5px; soild black; margin: 15px;
ย
.box { box-sizing: content-box; width: 300px; height: 200px; padding: 20px; border: 5px solid black; margin: 15px; }
ย

ย
box-sizing: border-box (border๊น์ง width์ ํฌํจ)
width: 300px; height: 200px; padding: 20px; border: 5px; soild black; margin: 15px;
ย
.box { box-sizing: border-box /* border๊น์ง width์ ํฌํจ */ width: 300px; height: 200px; padding: 20px; border: 5px solid black; margin: 15px; }
ย
CSS์ ๋ํด ์ข ๋ ์์ธํ ๋ด์ฉ์ ์๊ณ ์ถ๋ค๋ฉด, ์๋ ๋งํฌ๋ฅผ ์ฐธ๊ณ ํ์ธ์. ์ญ์ ๋ฌด๋ฃ์ฑ
์ด๋ฉฐ, ์ค๊ธ์๋ก ๋์ฝํ๊ธฐ ์ํ ์์ํ ๋ด์ฉ์ด ๋ด๊ฒจ์์ต๋๋ค. ๋ฆฌ๋๋ถ์ค์ ๋ฌด๋ฃ์ฑ
์ผ๋ก๋ ๊ณต๊ฐ๊ฐ ๋์ด์์ง๋ง, ์๋ Notion Page์์ ๋ณด์๋ ๊ฒ์ ์ถ์ฒํด๋๋ฆฝ๋๋ค.
ย
Web Animation 1๋ถ css AnimationWeb Animation 2๋ถ js Animationย
ย