๊ฐ์ธ ๊ณต๋ถ๋ฅผ ์ํด ์์ฑํ์ต๋๋ค
์น ํ์ด์ง๋ฅผ ๋ง๋ค ๋ HTML์ด ๋ผ๋์ ์ญํ ์ ํ๋ค๋ฉด, CSS๋ ๊ทธ ๋ผ๋ ์์ ๋์์ธ์ ํ๋, ๊พธ๋ฉฐ์ฃผ๋ ์ญํ ์ ํ๋ ์ธ์ด
Cascading: ํ๋์ element์ ๋ํด ๋ค์ํ ํจ๊ณผ๊ฐ ์ ์ฉ๋ ๋, ์ฐ์ ์์๋ฅผ ์ค์
์์ฑ ๋ฐฉ๋ฒ: ๊พธ๋ฉฐ์ค HTML ์์๋ฅผ ์ ํํ์ฌ ์ ์ฉ



* ๋ชจ๋ ์์ ์ ํtag๋ช
.class๋ช
#id๋ช
body {
์์ฑ : ๊ฐ;
color : blue;
}
์์1 ์์2 ์์1 ์์ ์๋ ๋ชจ๋ ์์์์2์์1>์์2 ๋ถ๋ชจ์์1 ๋ฐ๋ก ์๋์ ์๋ ์์์์2์์1+์์2 ํ์ ์์1 ์์ ์๋ ํ์ ์์2์์1~์์2 ์์1 ์ ๋ชจ๋ ํ์ ์์2์ ํ์1, ์ ํ์2 ์ฌ๋ฌ ์ ํ์๋ฅผ ํ๋ฒ์ ์ ํ:first-child ์ฒซ ๋ฒ์งธ ์์ ์์ ์ ํ:last-child ๋ง์ง๋ง ์์ ์์ ์ ํ:nth-child(n) ์์๊ด๊ณ์์ ์์์ n๋ฒ์งธ ์์ ์ ํ(์๋ฐฉํฅ):nth-last-child(n) ์์๊ด๊ณ์์ ๋ค์์ n๋ฒ์งธ ์์ ์ ํ(์ญ๋ฐฉํฅ)์ปจํ ์ธ ์ ๋์ด, ๋์ด, ํจ๋ฉ, ํ ๋๋ฆฌ, ๋ง์ง
/* ์ ์ฒด ์์์ ๋ํด ํ
๋๋ฆฌ ํฌํจํ์ฌ ๋ฐ์ค ์ฌ์ด์ง์ ํ๊ฒ ๋ค */
* {
box-sizing : border-box;
}
h1~h6 p div ul ol lia img spandisplay: block; display: inline; display: inline-block; block๊ณผ inline์ ์งฌ๋ฝ. ์ ์ผ ์ค์ํ ์ฑ์ง ์์ฒด๋ inline๊ณผ ๋น์ท. ๋์ผ ๋ผ์ธ์ ์ฌ๋ฌ ํ๊ทธ๋ฅผ ๋ถ์ผ ๋ ์ธ ์ ์๋ค. ๋ค๋ง ์ inline์ ๋จ์ ๋ค์ ์ปค๋ฒํ๋ ๊ฒ์ด inline-block์ด๋คdisplay: flex;display: inline-flex;display: grid;display: inline-grid;display: flow-root;display: none;display: contents;position: static;position: relative;
top: 40px; left: 40px;top: 40px; left: 40px;position: fixed;position: sticky;
top: 20px;z-index: auto | ์ ์ (1, 2, 3 ...);์ผ๋ช flexbox๋ผ ๋ถ๋ฆฌ๋ Flexible Box module์ ์์ดํ ๋ค์ ๊ณต๊ฐ ๋ฐฐ๋ถ๊ณผ ์ ๋ ฌ ๊ธฐ๋ฅ์ ์ ๊ณต. Flexbox์๋ 2๊ฐ์ง๊ฐ ์์
๋ฐ์ค์ ์ง์ ํ๋ ์์ฑ๊ณผ
display
flex-direction ์ค์ฌ์ถ์ ์ํ์ผ๋ก ๋๋๋ ์์ง์ผ๋ก ๋๋๋์ ๋ฐ๋ผ ๋ฐ๋์ถ์ด ์ํ์ด ๋๋ ์์ง์ด ๋๋ ๊ฒฐ์
row ๊ธฐ๋ณธ๊ฐ) ์ผ์ชฝ์์ ์ค๋ฅธ์ชฝ์ผ๋ก ์ํ์ผ๋ก ์ด๋row-reverse ์ญ๋ฐฉํฅ) ์ค๋ฅธ์ชฝ์์ ์ผ์ชฝ์ผ๋ก ์ํ์ผ๋ก ์ด๋column ์์์ ์๋๋ก ์์ง์ผ๋ก ์ด๋column-reverse ์ญ๋ฐฉํฅ) ์๋์์ ์๋ก ์์ง์ผ๋ก ์ด๋flex-wrap ํญ๋ชฉ์ด ๋๋ฌด ์ปค์ ํ ์ค์ ๋ชจ๋ ํ์ ํ ์์๋ ๊ฒฝ์ฐ ๋ค๋ฅธ ์ค๋ก ์ค ๋ฐ๊ฟ
flex-flow ๋ ์์ฑ flex-direction์ ์๊ธฐ flex-wrap๋ก ๊ฒฐํฉ
justify-content ์ค์ฌ์ถ์์ ์ ๋ ฌ
align-items
stretchflex-start ์์์ flex-end ๋์ ์์centeralign-content
๋ฐ์ค์์ ๋ค์ด๊ฐ๋ ์์ดํ ์ ์ง์ ํ๋ ์์ฑ์ด ์์
orderflex-grow ๋ฉด์ ์ปค์ง ๋ 2๋ฐฐ๋ก ์ปค์ ธ๋ผflex-shrink ์ค์ด๋ค ๋ ๋๋ฐฐ๋ก ๋ ์๊ฒ ์ค์ด๋ค์ด!flex-basis ์ค์ ํ ๋น์จ% ์ ์งํ๋ฉด์ ์ค์๋ค๊ฐ ์ปค์ก๋ค๊ฐ ํด!align-selfํฐํธ์ ๋ชจ์, ์ฌ์ด์ฆ, ์ปฌ๋ฌ ๋ฑ์ ์ ์ฉ
๋ฐฐ๊ฒฝ์ ๋ํด ์์, ์ด๋ฏธ์ง ๋ฑ์ ์ ์ฉ
background-colorbackground-imagebackground-positionbackground-repeatbackground-sizebackground-attachmentbackground-clipbackground-origin/* Using a <background-color> */
background: green;
/* Using a <bg-image> and <repeat-style> */
background: url("test.jpg") repeat-y;
/* Using a <box> and <background-color> */
background: border-box red;
/* A single image, centered and scaled */
background: no-repeat center/80% url("../img/image.png");
โ โ โ ๋ฏธ๋์ด ์ฟผ๋ฆฌ๋ ๋ฐ์ํ ์น ๋์์ธ์ ํต์ฌ ๋ถ๋ถ.
๋ทฐํฌํธ์ ํฌ๊ธฐ์ ๋ฐ๋ผ ์๋ก ๋ค๋ฅธ ์กฐํ์ ์์ฑํ ์ ์๊ธฐ ๋๋ฌธ
@media screen and (max-width: 400px) {
body {
color: blue;
}
}
โ ๋ชฉํ!