CSS
: Cascading Style Sheet
- ๋์์ธ ์์ ๋ด๋น
- Color , ์์น, ํฌ๊ธฐ ๋ด๋น
CSS ์์ฑ ์์น
a. Inline (๋น์ถ)
- Element์ Style ์์ฑ์ css์ฝ๋ ์์ฑ
b. Internal (๋น์ถ)
- Head ํ๊ทธ ๋ด์ <style></style> ๋ด์ css์ฝ๋ ์์ฑ
c. external (์ถ์ฒ)
- CSS์ฝ๋๋ง ์๋ ์ ์ฉ ํ์ผ ์์ฑ
- ์ฌ์ฉํ๋ ค๋ HTML ์์ Headํ๊ทธ ๋ด์ <link>๋ฅผ ์ด์ฉํด์ ๋ถ๋ฌ์ค๋ ๋ฐฉ์
1. ๋ฌธ๋ฒ
์ ํ์ {
์์ฑ๋ช : ๊ฐ;
์์ฑ๋ช : ๊ฐ2;
}
2. ์ ํ์ (Selector)
1) * : ์ ์ฒด ์ ํ์, ๋ชจ๋ Element๋ฅผ ์ ํ
2) ํ๊ทธ๋ช : ํ๊ทธ ์ ํ์
3) #id๋ช : ID ์ ํ์
4) .ํด๋์ค๋ช : Class ์ ํ์ (๊ธ๋ก๋ฒ์์ฑ)
5) ์ ํ์ A > ์ ํ์B : ์์ ์ ํ์, A์ ํ์์์ ์ง๊ณ ์์ B
6) ์ ํ์ A ์ ํ์ C: ํ์ ์ ํ์, A์ ํ์์์ ๋ชจ๋ C
ex) ์ ํ์A>์ ํ์B>์ ํ์C
=>์ ํ์A ์ ํ์C
์ด๋ ๊ฒ ์ฐ๋๊ฒ๋ ๊ฐ๋ฅํ๋ค.
์ ํ์๋ ์ด๊ฒ๋ง๊ณ ๋ ๋ง๋ค.
3. ๊ฐ์ ํด๋์ค(:pseudo-class)
1) ์ต์ปค(a) ๊ฐ์ ํด๋์ค
a. a: link : ์์ง ๋ฐฉ๋ฌธํ์ง ์์ ๋งํฌ
b. a: visited : ๋ฐฉ๋ฌธํ ํด๋์ค
c. a: hover : ๋ง์ฐ์ค์ ์ปค์๋ฅผ ์ฌ๋ ธ์ ๋
d. a: active : element(์์)๋ฅผ ๋๋ฅด๊ณ ์์ ๋
e. a: focus : ํฌ์ปค์ค๊ฐ ์๊ฒผ์ ๋
- hover, active, focus ๋ a ํ๊ทธ ๋ฟ๋ง์๋๋ผ ๋ค๋ฅธ ํ๊ทธ์์๋ ์ฌ์ฉ๊ฐ๋ฅ!
2) ์์ ๊ฐ์ ํด๋์ค
a. : first - child : ์ด๋ค ์์๋ค ์ค์์ ์ฒซ๋ฒ์งธ ์์ ์ ํ
b. : last -child : ์์๋ค ์ค ๋ง์ง๋ง ์์ ์ ํ
c. : nth-child(๋ฒํธ) : ๋ฒํธ์ ํด๋นํ๋ ์์ ์ ํ, ์์๋ฒํธ๋ 1๋ฒ
๋ฒํธ์ ํ์(odd) ์ง์(even) ๋ฃ์ด์ ์ฌ์ฉ ๊ฐ๋ฅ!
: nth-child(odd) : ํ์
: nth-child(even) : ์ง์
3) ํ์ ์์ ๊ฐ์ ํด๋์ค
a. : nth -of -type (๋ฒํธ) : ๊ฐ์ ํ์ ๋ค ์ค ๋ฒํธ์ ํด๋นํ๋ ์์ ์ ํ
4. ๊ฐ์ ์์
- ์ด๋ฏธ์ง๋ text ๊ทธ๋ผ๋ฐ์ด์ ์ถ๊ฐ ํ ๋ชฉ์
a. :: before : ์ ํํ ์์ ์์ ๊ฐ์์ ์์๋ฅผ ์ถ๊ฐ
b. :: after : ์ ํํ ์์ ๋ค์ ๊ฐ์์ ์์๋ฅผ ์ถ๊ฐ
p :: before{
content : "Text";
}
p :: after{
content : url("image ๊ฒฝ๋ก");
}
1. Text
1. Color
- Text์ ์ ์ง์
2. text-decoration
- UnderLine
- OverLine
- Line-through
- none(์ ์ด ์์)
- ์ธ๋๋ฐ, ์์ , ์ค๊ฐ์ , none
3. line - height
- ์ค ๊ฐ๊ฒฉ
- Text์ ์์ง ์ ๋ ฌ์์๋ ์ฌ์ฉ
4. Text - align
- ์ํ์ ๋ ฌ
- left
- center
- right
- justify -> ์์ ํ์ชฝ๋์ ์์
5. text - transform
- text์ ์ฒซ๊ธ์๋ฅผ ๋๋ฌธ์๋ก ๋ณ๊ฒฝ
6. text - indent
- ์ฒซ์ค ๋ค์ฌ์ฐ๊ธฐ
7. letter - spacing
- ๊ธ์๊ฐ์ ๊ฐ๊ฒฉ
8. word - spacing
- ๋จ์ด๊ฐ์ ๊ฐ๊ฒฉ
Font
์์ฒด, ํฌ๊ธฐ, ์คํ์ผ
1. font - size : ํฐํธ ํฌ๊ธฐ ์ง์
2. font - weight : ๋ณผ๋์ฒด ์ง์ , ๊ธฐ์กด ํฐํธ์ ๊ตต๊ธฐ
- bold, bolder , lighter
3. font - style: italic์ฒด ์ง์
4. font-family
- ์์ฒด ์ง์ , ์ปดํจํฐ์ ํฐํธ๊ฐ ์์ด์ผ ํจ
- ํ๊ธ์ด๋ฆ์ ์์ฒด๋ ๋์ด์ฐ๊ธฐ๊ฐ ์๋ ์๋ฌธ ์์ฒด๋ ' '๋ " " ๋ก ๊ฐ์ธ์ผ ํจ
- web font (์๋์ผ๋ก ๋ค์ด)
-- font๋ฅผ ์ ๊ณตํ๋ Cloud Server ์ด์ฉ
- @font - face: ์ด์์๋ฒ์ ์๋ ํฐํธ๋ฅผ ํด๋ผ์ด์ธํธ์๊ฒ ๋ค์ด๋ก๋
src: url (๊ฒฝ๋ก๋ช )
Box Model
- ๋ค์ 4๊ฐ์ง๊ฐ ๋ชจ์ฌ์ ํ๋์ Box๋ผ๊ณ ํจ
0. ๊ฐ๋ก(width) ์ธ๋ก(height)
- box์ ๊ฐ๋ก ์ธ๋ก ์ฌ์ด์ฆ ์กฐ์
1) width
2) height
1. margin
Element(Box)์ Element(Box)๊ฐ์ ๊ฐ๊ฒฉ
top, right, bottom, left
margin - ๋ฐฉํฅ : ์์น
short-hand
- margin : top, right, bottom, left (์๊ณ๋ฐฉํฅ)
ex) margin: 10px 50px 20px 30px
- top๊ณผ bottom ์์น๊ฐ ๊ฐ๊ณ right left๊ฐ ์์น๊ฐ ๊ฐ์ ๋
margin : top(buttom) right(left)
- top, right, bottom, left ๋ชจ๋ ๋์ผํ ์์น ์ผ ๋
margin : ์์น
- ์์ํ๊ทธ์์ margin-top์ ์ค ๊ฒฝ์ฐ ๋ถ๋ชจ์ ๋์ผํ๊ฒ ์์ง์ด๋ ๋ฒ๊ทธ ๋ฐ์
- ๋ถ๋ชจํ๊ทธ์ overflow : hidden; ์ ์ฃผ๋ฉด ํด๊ฒฐ๋๋ค.
-margin : 0px auto; => ์ํ๋ 0px auto๋ ์๋์ผ๋ก ๋ถ๋ชจ x๊ฐ์ ์ค๊ฐ์ ์์น ์ข์ฐ์ ๋ ฌ์ ํด์ค๋ค!
2. border
element์ ํ ๋๋ฆฌ
Top, Right, Bottom, Left
1) 3๊ฐ์ง ์์
a. color : ์ ์ ์
b. style : ์ ์ ์ข ๋ฅ (solid -์ค์ , dotted -์ ์ )
c. width : ์ ์ ๋๊ป
2) ์ฌ์ฉ๋ฒ
border - ๋ฐฉํฅ - color
border - ๋ฐฉํฅ - style
border - ๋ฐฉํฅ - width
-short hand (๋จ์ถ)
border - ๋ฐฉํฅ : color๊ฐ width๊ฐ style๊ฐ
-4๋ฐฉํฅ ๋ชจ๋ ๊ฐ์ ๊ฐ์ ๊ฐ์ง ๋
border : color๊ฐ width๊ฐ style๊ฐ
3) Round ์ฒ๋ฆฌ
border -radius
border - top - left - radius :
border - top - right - radius :
border - bottom - right -radius :
border - bottom - left - radius :
- short hand(ํ๊บผ๋ฒ์ 4๊ฐ๋ฅผ ์ฃผ๊ณ ์ถ์๋)
border-radius: TL TR BR BL
4) table border
-td์ td๊ฐ์ ๊ฐ๊ฒฉ์ด ์กด์ฌ
a. ๊ฐ๊ฒฉ ์กฐ์ : border-spacing : ๊ฐ;
b. spacing์ด 0 ์ผ๋ ๊ฐ๊ฐ์ border ์ฒ๋ฆฌ
-border -collapes
--collapse: ํฉ์ณ์ง ์ ๋ค ์ค ํ๋๋ง ์ฌ์ฉ
--separate : ๋๋ค ์ฌ์ฉ
3. padding
ํ ๋๋ฆฌ์ contents๊ฐ์ ๊ฐ๊ฒฉ
์ฌ์ฉ๋ฐฉ๋ฒ์ Margin ๊ณผ ๋์ผ
top, right, bottom, left
padding - ๋ฐฉํฅ : ์์น
padding : top right bottom left
padding : top(bottom) right(left)
padding : ์์น
4. box-sizing
1) content-box : ๊ธฐ๋ณธ๊ฐ, padding์ ์์น์ ๋ฐ๋ผ boxํฌ๊ธฐ๊ฐ ์ปค์ง
2) border-box : padding๋ด์ ์์น์ ์๊ด์์ด box ํฌ๊ธฐ๋ ๊ณ ์ !
5. Contents
Element๋ด์ contents(Element, Text ๋ฑ)
*ํ๋ฆฌ๊ฑฐ๋ ๋ฌธ์ ๊ฐ ์์ ์ ๋ฐ๋ก ์์ ํ๊ฒ ์ต๋๋ค!
๋๊ธ๋ก ๋จ๊ฒจ์ฃผ์๋ฉด ๊ฐ์ฌํ๊ฒ ์ต๋๋ค :)
'23. Front-end > 23. html css javascript' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[HTML] Form ์ฌ์ฉ์๋ก๋ถํฐ ์ ๋ ฅ๋ฐ๊ฑฐ๋ ์ ํํ ๋, ์ ๋ ฅํ๊ทธ, Button (0) | 2022.02.15 |
---|---|
[HTML] ๊ทธ๋ฃนํ๊ทธ, List, Semantic (0) | 2022.02.10 |
[CSS] ์ ๋ ฌ, size ๋จ์, color, reset (0) | 2022.02.10 |
[HTML] html๊ตฌ์กฐ, element์ ๊ตฌ์ฑ์์, Text, Link , Media, Table (0) | 2022.02.04 |
[Front End]์ฃผ์ ๊ธฐ๋ณธ ๊ฐ๋ ๊ณผ ์ฐธ๊ณ ํ ๋งํ ์ฌ์ดํธ (0) | 2022.02.04 |