Notice
Recent Posts
Recent Comments
ยซ   2024/12   ยป
์ผ ์›” ํ™” ์ˆ˜ ๋ชฉ ๊ธˆ ํ† 
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
Archives
Today
In Total
๊ด€๋ฆฌ ๋ฉ”๋‰ด

A Joyful AI Research Journey๐ŸŒณ๐Ÿ˜Š

[7] 230105 Ch. 6 CSS ๋ ˆ์ด์•„์›ƒ๊ณผ ์• ๋‹ˆ๋ฉ”์ด์…˜: ๋ ˆ์ด์•„์›ƒ์˜ ๊ธฐ์ดˆ, ์š”์†Œ ์œ„์น˜ ์ •ํ•˜๊ธฐ, <div> ์š”์†Œ · ์˜๋ฏธ์  ์š”์†Œ๋ฅผ ์ด์šฉํ•œ ๋ ˆ์ด์•„์›ƒ, ํšจ๊ณผ, CSS3 ๋ณ€ํ™˜ · 3์ฐจ์› ๋ณ€ํ™˜ · ์• ๋‹ˆ๋ฉ”์ด์…˜ [K-๋””์ง€ํ„ธ ํŠธ๋ ˆ์ด๋‹ 7์ผ] ๋ณธ๋ฌธ

๐ŸŒณBootcamp Revision 2023โœจ/HTML5, CSS3, JSP

[7] 230105 Ch. 6 CSS ๋ ˆ์ด์•„์›ƒ๊ณผ ์• ๋‹ˆ๋ฉ”์ด์…˜: ๋ ˆ์ด์•„์›ƒ์˜ ๊ธฐ์ดˆ, ์š”์†Œ ์œ„์น˜ ์ •ํ•˜๊ธฐ, <div> ์š”์†Œ · ์˜๋ฏธ์  ์š”์†Œ๋ฅผ ์ด์šฉํ•œ ๋ ˆ์ด์•„์›ƒ, ํšจ๊ณผ, CSS3 ๋ณ€ํ™˜ · 3์ฐจ์› ๋ณ€ํ™˜ · ์• ๋‹ˆ๋ฉ”์ด์…˜ [K-๋””์ง€ํ„ธ ํŠธ๋ ˆ์ด๋‹ 7์ผ]

yjyuwisely 2023. 1. 5. 12:50

230105 Thu 7th class

Ch. 5 CSS3 ๋ฐ•์Šค ๋ชจ๋ธ๊ณผ ์‘์šฉ (์ฃผ์ œ๋ณ„๋กœ ๋ฌถ๊ธฐ ์œ„ํ•ด ์•„๋žซ๊ธ€๋กœ ๊ธ€ ๋‚ด์šฉ ์˜ฎ๊น€.) 
Ch. 6 CSS ๋ ˆ์ด์•„์›ƒ๊ณผ ์• ๋‹ˆ๋ฉ”์ด์…˜

์ง„๋„: p. 181 ~  (๊ต์žฌ: HTML5 + CSS3 + JavaScript๋กœ ๋ฐฐ์šฐ๋Š” ์›นํ”„๋กœ๊ทธ๋ž˜๋ฐ ๊ธฐ์ดˆ, ์ €์ž: ์ฒœ์ธ๊ตญ)

 

HTML5+CSS3+JavaScript๋กœ ๋ฐฐ์šฐ๋Š” ์›นํ”„๋กœ๊ทธ๋ž˜๋ฐ ๊ธฐ์ดˆ | ์ฒœ์ธ๊ตญ - ๊ต๋ณด๋ฌธ๊ณ 

HTML5+CSS3+JavaScript๋กœ ๋ฐฐ์šฐ๋Š” ์›นํ”„๋กœ๊ทธ๋ž˜๋ฐ ๊ธฐ์ดˆ | ์›นํ”„๋กœ๊ทธ๋ž˜๋ฐ ์ดˆ๋ณด์ž๋„ ์‰ฝ๊ฒŒ ๋ฐฐ์šฐ๋Š” ์›น ๊ฐœ๋ฐœ ์ง€์นจ์„œ!์ด ์ฑ…์€ ์›นํ”„๋กœ๊ทธ๋ž˜๋ฐ์„ ์ฒ˜์Œ ๋ฐฐ์šฐ๋Š” ์ดˆ๋ณด์ž๋“ค์„ ์œ„ํ•ด ๊ธฐ์ดˆ๋ถ€ํ„ฐ ์ฐจ๊ทผ์ฐจ๊ทผ ์„ค๋ช…ํ•œ๋‹ค. 1~3์žฅ์—

product.kyobobook.co.kr

์˜ค๋Š˜ ๋ฐฐ์šด ๊ฒƒ ์ค‘ ๊ธฐ์–ตํ•  ๊ฒƒ์„ ์ •๋ฆฌํ–ˆ๋‹ค.


์ง€๋‚œ ์ˆ˜์—…์—์„œ ๋ฐฐ์šด ๊ฒƒ ์ค‘ ๋‹ค์‹œ ๊ธฐ์–ตํ•  ๊ฒƒ

ํ…Œ์ด๋ธ” ๋งŒ๋“ค ๋•Œ 
th = table header ํ…Œ์ด๋ธ” ํ—ค๋”
tr = table row ํ–‰
td = table data

 

์„ ํƒ์ž

2023.01.03 - [1. Revision 2023/CSS3] - [5] 230103 Ch. 4 CSS3 ์Šคํƒ€์ผ ์‹œํŠธ ๊ธฐ์ดˆ: CSS ๊ฐœ๋…, ์„ ํƒ์ž, CSS๋ฅผ ์‚ฝ์ž…ํ•˜๋Š” ๋ฐฉ๋ฒ•, ์ƒ‰์ƒ, ํฐํŠธ, ํ…์ŠคํŠธ ์Šคํƒ€์ผ ์„ค์ •

์•„์ด๋”” ์„ ํƒ์ž (#)
#๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค. ํ•˜๋‚˜์˜ ์š”์†Œ๋งŒ ์„ ํƒํ•  ์ˆ˜ ์žˆ๋‹ค. ๊ณ ์œ ๋ช…์‚ฌ์ด๋‹ค. ๋™์ผ ์ด๋ฆ„์€ ์•ˆ ๋œ๋‹ค.
ex) #list td, #list th
ex) #special{ color : red } 
ex) <h1> ์š”์†Œ ์ค‘์—์„œ ์•„์ด๋””๊ฐ€ "special"์ธ ์š”์†Œ๋ฅผ ์„ ํƒํ•จ
h1#special { color : blue; }

ํด๋ž˜์Šค ์„ ํƒ์ž (. )
. ๋ฅผ ์ด์šฉํ•ด์„œ ์ •์˜๋œ๋‹ค. ๋ช‡ ๊ฐœ์˜ ์š”์†Œ๋ฅผ ํ•˜๋‚˜์˜ ํด๋ž˜์Šค๋กœ ๋ฌถ์–ด์„œ ์Šคํƒ€์ผ์„ ์ง€์ •ํ•˜๋ ค๊ณ  ํ•  ๋•Œ ์‚ฌ์šฉ๋œ๋‹ค. 
์—ฌ๋Ÿฌ ๊ฐœ๋ฅผ ์š”์†Œ๋ฅผ ํ•œ๊บผ๋ฒˆ์— ์„ ํƒํ•  ์ˆ˜ ์žˆ๋‹ค. ์š”์†Œ๋ฅผ ์ •์˜ํ•  ๋•Œ ํด๋ž˜์Šค ์ด๋ฆ„์„ ๋ถ€์—ฌํ•  ์ˆ˜ ์žˆ๋‹ค. ๋™์ผ ์ด๋ฆ„ ๋œ๋‹ค.
ex) #list tr.alt td 
ex) ํด๋ž˜์Šค๊ฐ€ target์ธ ์š”์†Œ๋ฅผ ์„ ํƒํ•œ๋‹ค.
.target { color : red } 

์ž์†(s1 s2), ์ž์‹ (s1>s2), ํ˜•์ œ ๊ฒฐํ•ฉ์ž p. 118

์„ ํƒ์ž ์„ค๋ช…
s1 s2 s1 ์š”์†Œ์— ํฌํ•จ๋œ s2 ์š”์†Œ๋ฅผ ์„ ํƒํ•œ๋‹ค (ํ›„์† ๊ด€๊ณ„ = 3์„ธ๋Œ€)
ex) #list tr.alt td
ex) body h1 {color:yellow;}
s1 > s2 s1 ์š”์†Œ์˜ ์ง๊ณ„ ์ž์‹ ์š”์†Œ์ธ s2๋ฅผ ์„ ํƒํ•œ๋‹ค (์ž์‹ ๊ด€๊ณ„ = 2์„ธ๋Œ€) 
ex) body, h1 [color:yellow;}

 

๋ฆฌ์ŠคํŠธ์— ๋งํฌ ๋„ฃ๊ธฐ

<li><a href="http://www.google.com">๊ตฌ๊ธ€</a></li>


์•ž ๊ธ€์ž๋งŒ ๋Œ€๋ฌธ์ž๋กœ ๋ฐ”๊พธ๊ธฐ

text-transform: capitalize;

 

๊ฐ’์€ ์ฝค๋งˆ๋กœ ๊ตฌ๋ถ„ํ•˜์—ฌ ๋Œ€์ฒด๊ฐ€ ๋  ์ˆ˜ ์žˆ์Œ์„ ๋‚˜ํƒ€๋‚ธ๋‹ค.

font family: ํฐํŠธ, ํฐํŠธ, ํฐํŠธ

 

<img src=" " alt="๋ฌธ์ž">


alt๋Š” ์ด๋ฏธ์ง€๊ฐ€ ์•ˆ ๋œฐ ๋•Œ ๋‚˜์˜ค๋Š” ๋Œ€์ฒด ํ…์ŠคํŠธ์ด๋‹ค.


Ch. 6 CSS3 ๋ ˆ์ด์•„์›ƒ๊ณผ ์• ๋‹ˆ๋ฉ”์ด์…˜ p.192

์ฑ…์˜ ๋ชฉ์ฐจ
-๋ ˆ์ด์•„์›ƒ์˜ ๊ธฐ์ดˆ
-์š”์†Œ ์œ„์น˜ ์ •ํ•˜๊ธฐ
-<div> ์š”์†Œ๋ฅผ ์ด์šฉํ•œ ๋ ˆ์ด์•„์›ƒ
-์˜๋ฏธ์  ์š”์†Œ๋ฅผ ์ด์šฉํ•œ ๋ ˆ์ด์•„์›ƒ
-ํšจ๊ณผ
-CSS3 ๋ณ€ํ™˜
-CSS3 3์ฐจ์› ๋ณ€ํ™˜
-CSS3 ์• ๋‹ˆ๋ฉ”์ด์…˜

1. ๋ ˆ์ด์•„์›ƒ์˜ ๊ธฐ์ดˆ

์›น ํŽ˜์ด์ง€ ๋ ˆ์ด์•„์›ƒ์—๋Š” HTML ์š”์†Œ์˜ ์œ„์น˜, ํฌ๊ธฐ ๋“ฑ์ด ํฌํ•จ๋˜์–ด ์žˆ๋‹ค. 

 

1.1 ๋ฐ•์Šค๋ชจ๋ธ (Box model)

๋ฐ•์Šค ๋ชจ๋ธ์ด๋ž€ ์›น ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ๊ฐ ์š”์†Œ๋ฅผ ํ™”๋ฉด์— ๊ทธ๋ฆด ๋•Œ ๋ฌด์กฐ๊ฑด ์‚ฌ๊ฐํ˜•์œผ๋กœ ๊ฐ„์ฃผํ•œ๋‹ค๋Š” ๊ฒƒ์ด๋‹ค.
์‚ฌ๊ฐํ˜•์—๋Š” ํ•ด๋”ฉ, ๊ฒฝ๊ณ„์„ , ๋งˆ์ง„์ด ๋ถ™์–ด์žˆ๋‹ค.
์š”์†Œ๋ฅผ ๋ฐฐ์น˜ํ•  ๋•Œ๋„ ๋ธŒ๋ผ์šฐ์ €๋Š” ์š”์†Œ๋ฅผ ์‚ฌ๊ฐํ˜•์œผ๋กœ ๊ฐ„์ฃผํ•œ๋‹ค.

 

1.2 ๋ธ”๋ก์š”์†Œ์™€ ์ธ๋ผ์ธ ์š”์†Œ

HTML ์š”์†Œ๋Š” ๋ธ”๋ก ์š”์†Œ์ด๊ฑฐ๋‚˜ ์ธ๋ผ์ธ ์š”์†Œ ์ค‘์˜ ํ•˜๋‚˜์— ์†ํ•œ๋‹ค. 

๋ธ”๋ก ์š”์†Œ (Block element) ์ธ๋ผ์ธ ์š”์†Œ (Inline element)
- ํ™”๋ฉด์˜ ํ•œ ์ค„์„ ์ „๋ถ€ ์ฐจ์ง€ํ•œ๋‹ค. 

1. ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ 
์ตœ๋Œ€ ๊ฐ€๋กœ ๋„ˆ๋น„๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.
(๊ธฐ๋ณธ ๋„ˆ๋น„๊ฐ’์€ 100% )


2. ์ „์ฒด๋ฅผ ์ฐจ์ง€ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๊ฐ ์š”์†Œ๋“ค์ด ์ˆ˜์ง์œผ๋กœ ์Œ“์ธ๋‹ค.
(ํ•œ ์ค„์— ํ•œ๊ฐœ๋งŒ ๋ฐฐ์น˜ )


3. ํฌ๊ธฐ๊ฐ’ ๊ฐ€์งˆ ์ˆ˜ ์žˆ๋‹ค.
(๊ฐ€๋กœ ๋„ˆ๋น„, ์„ธ๋กœ ๊ธธ์ด ์ง€์ • ๊ฐ€๋Šฅํ•˜๋‹ค)


4. ์ƒํ•˜์ขŒ์šฐ ๋งˆ์ง„, ํŒจ๋”ฉO

5. ๋ ˆ์ด์•„์›ƒ์„ ์ž‘์—…ํ•˜๋Š” ์š”์†Œ๋กœ ์ ํ•ฉํ•˜๋‹ค.
- ํ•œ ์ค„์— ์ฐจ๋ก€๋Œ€๋กœ ๋ฐฐ์น˜๋œ๋‹ค.
ํ˜„์žฌ ์ค„์—์„œ ํ•„์š”ํ•œ ๋งŒํผ์˜ ๋„ˆ๋น„๋งŒ์„ ์ฐจ์ง€ํ•œ๋‹ค. 

1. ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ 
ํ•„์š”ํ•œ ๋งŒํผ์˜ ์˜์—ญ์„ ์‚ฌ์šฉํ•œ๋‹ค.
(์ฝ˜ํ…์ธ  ๋„ˆ๋น„ ๋งŒํผ)

2. ์š”์†Œ๋“ค์ด ์ˆ˜ํ‰์œผ๋กœ ์Œ“์ธ๋‹ค.
(ํ•œ ์ค„์— ์—ฌ๋Ÿฌ๊ฐœ ๋ฐฐ์น˜ )


3. ํฌ๊ธฐ๊ฐ’ ๊ฐ€์งˆ ์ˆ˜ ์—†๋‹ค.
(์‚ฌ์ด์ฆˆ ์ง€์ • ๋ถˆ๊ฐ€๋Šฅ )


4. ์ƒํ•˜ ๋งˆ์ง„ ์ ์šฉX
(์ขŒ์šฐ ๋งˆ์ง„, ์ƒํ•˜์ขŒ์šฐ ํŒจ๋”ฉ๋„ ๊ฐ€๋Šฅ )

5. ํ…์ŠคํŠธ๋ฅผ ์ž‘์—…ํ•˜๋Š” ์š”์†Œ๋กœ ์ ํ•ฉํ•˜๋‹ค.

์ฐธ๊ณ : https://www.w3schools.com/html/html_blocks.asp

1) ๋ธ”๋ก์š”์†Œ p.193

๋ธ”๋ก ์š”์†Œ๋Š” ๋ธŒ๋ผ์šฐ์ €์˜ ํ•œ ์ค„์„ ๋ชจ๋‘ ์ฐจ์ง€ํ•œ๋‹ค. (ํ•œ ์ค„์— ํ•˜๋‚˜์”ฉ ๋ฐฐ์น˜๋œ๋‹ค.)
๊ฐœ๋ฐœ์ž ๋„๊ตฌ ๋ดค์„ ๋•Œ ๊ณต๊ฐ„ ๋๊นŒ์ง€ ์˜ค๋ฉด ๋ธ”๋ก์š”์†Œ์ด๋‹ค.

<h1>, <p>, <ul>, <li>, <table>, <blockquote>, <pre>, <div>, <form>, <header>, <nav>
<pre>
: ๋ฏธ๋ฆฌ ์ •์˜๋œ ํ˜•์‹(preformatted)์˜ ํ…์ŠคํŠธ๋ฅผ ์ •์˜ํ•  ๋•Œ ์‚ฌ์šฉํ•œ๋‹ค.

 

2) ์ธ๋ผ์ธ ์š”์†Œ p.194

์ธ๋ผ์ธ ์š”์†Œ๋Š” ์ •์ƒ์ ์œผ๋กœ๋Š” ํ•œ ์ค„ ์•ˆ์— ์ฐจ๋ก€๋Œ€๋กœ ๋ฐฐ์น˜๋œ๋‹ค. ๋…ผ๋ฆฌ์ ์ธ ์„น์…˜์„ ์ƒ์„ฑํ•˜๊ธฐ ์œ„ํ•œ ์š”์†Œ์ด๋‹ค. 

<a>, <img>, <strong>, <em>, <br>, <input>, <span>


1.3 ๋ธ”๋ก ์š”์†Œ์™€ ์ธ๋ผ์ธ ์š”์†Œ์˜ ํ˜ผํ•ฉ 

์ผ๋ฐ˜์ ์œผ๋กœ ์›น ํŽ˜์ด์ง€์—๋Š” ๋ธ”๋ก ์š”์†Œ์™€ ์ธ๋ผ์ธ ์š”์†Œ๊ฐ€ ํ˜ผํ•ฉ๋˜์–ด ์žˆ๋‹ค.
์ด ๊ฒฝ์šฐ์—๋Š” ๋ธ”๋ก ์š”์†Œ๊ฐ€ ๋‚˜ํƒ€๋‚  ๋•Œ๊นŒ์ง€ ์ธ๋ผ์ธ ์š”์†Œ๋Š” ๊ฐ™์€ ์ค„์— ๋ฐฐ์น˜๋œ๋‹ค.
๋ธ”๋ก ์š”์†Œ๊ฐ€ ๋‚˜ํƒ€๋‚˜๋ฉด ์ค„์ด ๋ถ„๋ฆฌ๋˜๊ณ  ๋ธ”๋ก ์š”์†Œ๋Š” ์ƒˆ๋กœ์šด ์ค„์— ๋ฐฐ์น˜๋œ๋‹ค.

 

1.4 CSS๋กœ display ์†์„ฑ ๋ณ€๊ฒฝํ•˜๊ธฐ

HTML ์š”์†Œ๋Š” ์ž๋™์ ์œผ๋กœ ๋ธ”๋ก ์š”์†Œ์™€ ์ธ๋ผ์ธ ์š”์†Œ๋กœ ๋‚˜๋ˆ„์–ด์ ธ ์žˆ๋Š”๋ฐ, ์ด ์†์„ฑ์€ CSS ์ฝ”๋“œ๋ฅผ ํ†ตํ•˜์—ฌ ๋ณ€๊ฒฝ๋  ์ˆ˜ ์žˆ๋‹ค.
์†์„ฑ display๋ฅผ block์œผ๋กœ ์„ค์ •ํ•˜๋ฉด ๋ธ”๋ก ์š”์†Œ์ฒ˜๋Ÿผ ๋ฐฐ์น˜๋˜๊ณ ,
display๋ฅผ inline์œผ๋กœ ์„ค์ •ํ•˜๋ฉด ์ธ๋ผ์ธ ์š”์†Œ์ฒ˜๋Ÿผ ๋ฐฐ์น˜๋œ๋‹ค.

ํŽ˜์ด์ง€์˜ ๋ ˆ์ด์•„์›ƒ์„ ์ž‘์„ฑํ•  ๋•Œ ์•„์ฃผ ์œ ์šฉํ•˜๊ฒŒ ์‚ฌ์šฉ๋œ๋‹ค. ํ•„์š”์— ๋”ฐ๋ผ์„œ ์š”์†Œ๋ฅผ ๋ธ”๋ก ์š”์†Œ ๋˜๋Š” ์ธ๋ผ์ธ ์š”์†Œ๋กœ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค. 

ex) <div> ์š”์†Œ๋Š” ๋ณธ์งˆ์ ์œผ๋กœ ๋ธ”๋ก ์š”์†Œ์ด์ง€๋งŒ display๋ฅผ inline์œผ๋กœ ์„ค์ •ํ•ด์„œ ์ธ๋ผ์ธ ์š”์†Œ๋กœ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๋‹ค.

div { display: inline;}

display: ๋ธ”๋ก ์š”์†Œ๋ƒ ์ธ๋ผ์ธ ์š”์†Œ๋ƒ๋ฅผ ๊ฒฐ์ •ํ•œ๋‹ค.
inline: ์ธ๋ผ์ธ ์š”์†Œ์ฒ˜๋Ÿผ ๋ฐฐ์น˜๋œ๋‹ค. 

์ฐธ๊ณ  p. 196 

display:block /*๋ธ”๋ก(block)*/
display:inline /*์ธ๋ผ์ธ(inline)*/
display:none /*์—†๋Š” ๊ฒƒ์œผ๋กœ ๊ฐ„์ฃผ๋จ*/
display:hidden /*ํ™”๋ฉด์—์„œ ๊ฐ์ถฐ์ง*/

display: none: ๋ฌธ์„œ์˜ ํ๋ฆ„์—์„œ ํ•ด๋‹น ์š”์†Œ๋ฅผ ์™„์ „ํžˆ ๋ฐฐ์ œํ•˜๊ณ ์ž ํ•  ๋•Œ ์‚ฌ์šฉ๋œ๋‹ค.
display: hidden: ๋ฌธ์„œ์˜ ํ๋ฆ„์—์„œ ์š”์†Œ๊ฐ€ ์ œ๊ฑฐ๋˜์ง€ ์•Š์ง€๋งŒ ๋ณด์ด์ง€๋Š” ์•Š๋Š” ์ƒํƒœ์ด๋‹ค.

๋ฆฌ์ŠคํŠธ(๋ชฉ๋ก) ํ•ญ๋ชฉ์„ ๋‚˜ํƒ€๋‚ด๋Š” ๋ฐ ์‚ฌ์šฉ๋˜๋Š” <li> ์š”์†Œ๋Š” ๋ธ”๋ก์š”์†Œ์ด๋‹ค. 
๋ฆฌ์ŠคํŠธ๋ฅผ ์ˆ˜ํ‰ ๋ฉ”๋‰ด๋กœ ์‚ฌ์šฉํ•˜๊ณ ์ž ํ•˜๋ฉด <li>๋ฅผ ์ธ๋ผ์ธ ์†์„ฑ์œผ๋กœ ๋ณ€๊ฒฝํ•˜๋ฉด ๋œ๋‹ค. 

CSS๋กœ display ์†์„ฑ์„ ๋ณ€๊ฒฝ์‹œํ‚ฌ ์ˆ˜ ์žˆ์ง€๋งŒ ์ฃผ์˜ํ•  ์ ๋„ ์žˆ๋‹ค.
ex) ์ธ๋ผ์ธ ์š”์†Œ ์•ˆ์— ๋ธ”๋ก ์š”์†Œ๋ฅผ ๋„ฃ์œผ๋ฉด ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋‹ค.


2. ์š”์†Œ ์œ„์น˜ ์ •ํ•˜๊ธฐ (position) p. 197

๊ธฐ๋ณธ์ ์œผ๋กœ ์š”์†Œ์˜ ์œ„์น˜๋Š” top, bottom, left, right ์†์„ฑ์œผ๋กœ ์ง€์ •ํ•œ๋‹ค.
์ด๋“ค ์†์„ฑ์€ ์š”์†Œ์˜ ์œ„์น˜๋ฅผ ๊ฒฐ์ •ํ•œ๋‹ค. ์ด๋“ค ๊ฐ’์€ ๋ชจ๋‘ ์˜คํ”„์…‹(offset)์ด๋‹ค. p. 212
top: ์œ„๋กœ๋ถ€ํ„ฐ์˜ ์˜คํ”„์…‹ 
bottom: ์•„๋ž˜๋กœ๋ถ€ํ„ฐ์˜ ์˜คํ”„์…‹ 
left: ์™ผ์ชฝ์œผ๋กœ๋ถ€ํ„ฐ์˜ ์˜คํ”„์…‹ 
right: ์˜ค๋ฅธ์ชฝ๋กœ๋ถ€ํ„ฐ์˜ ์˜คํ”„์…‹ 

์˜ˆ์‹œ) ๊ธฐ์ค€ ์œ„์น˜์—์„œ (100, 200)๋งŒํผ ๋–จ์–ด์ง„ ๊ณณ์— ์š”์†Œ๊ฐ€ ๋ฐฐ์น˜๋œ๋‹ค.

#target{ top: 100px; left: 200px;}

Property Values p. 212

Value Description
static (1. ์ •์ ) Default value. Elements render in order, as they appear in the document flow.

๋””ํดํŠธ ์œ„์น˜: ์š”์†Œ๋Š” ์ •์ƒ์ ์ธ ํ๋ฆ„์— ๋”ฐ๋ผ์„œ ๋ฐฐ์น˜๋œ๋‹ค.
top/left/bottom/right ์†์„ฑ์€ ๋ฌด์‹œ๋œ๋‹ค. 
relative (2. ์ƒ๋Œ€) The element is positioned relative to its normal position,
so "left:20px" adds 20 pixels to the element's LEFT position.

(์ •์ƒ์ ์ธ ์œ„์น˜์— ๋Œ€ํ•˜์—ฌ ์ƒ๋Œ€์ ์œผ๋กœ ์š”์†Œ๊ฐ€ ๋ฐฐ์น˜๋˜๋Š” ๋ฐฉ๋ฒ•์ด๋‹ค.)


relative: having meaning or significance only in relation to something elsenot absolute
absolute (3. ์ ˆ๋Œ€) The element is positioned relative to its first positioned (not static) ancestor element.

์š”์†Œ๋Š” ์ปจํ…Œ์ด๋„ˆ ์•ˆ์—์„œ ๊ณ ์ •๋œ ์œ„์น˜์— ๋ฐฐ์น˜๋œ๋‹ค. 
(ํŽ˜์ด์ง€์˜ ์‹œ์ž‘ ์œ„์น˜์—์„œ top, left, bottom, right ๋งŒํผ ๋–จ์–ด์ง„ ์œ„์น˜์— ๋ฐฐ์น˜๋œ๋‹ค.)

absolute: viewed or existing independently and not in relation to other thingsnot relative or comparative
fixed (4. ๊ณ ์ •) The element is positioned relative to the browser window.

(๋ธŒ๋ผ์šฐ์ € ์œˆ๋„์šฐ ์•ˆ์—์„œ ๊ณ ์ •๋œ ์œ„์น˜์— ๋ฐฐ์น˜๋œ๋‹ค.
ํŽ˜์ด์ง€๊ฐ€ ์Šคํฌ๋กค๋˜์–ด๋„ ์›€์ง์ด์ง€ ์•Š๋Š”๋‹ค.)
sticky The element is positioned based on the user's scroll position.
A sticky element toggles between relative and fixed, depending on the scroll position.
It is positioned relative until a given offset position is met in the viewport - then it "sticks" in place (like position:fixed).

Note: Not supported in IE/Edge 15 or earlier. Supported in Safari from version 6.1 with a -webkit- prefix.
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

์ฐธ๊ณ : https://www.w3schools.com/cssref/pr_class_position.php


2.1 ์ •์  ์œ„์น˜ ์„ค์ • (Static positioning)

ํŽ˜์ด์ง€์˜(๋ฌธ์„œ์˜) ์ •์ƒ์ ์ธ ํ๋ฆ„์— ๋”ฐ๋ผ ์š”์†Œ์˜ ์œ„์น˜๊ฐ€ ๊ฒฐ์ •๋˜๋Š” ๋ฐฉ๋ฒ•์ด๋‹ค. 
์ฆ‰ ๋ธ”๋ก ์š”์†Œ๋Š” ๋ฐ•์Šค์ฒ˜๋Ÿผ ์ƒํ•˜๋กœ ์Œ“์ด๊ฒŒ ๋˜๊ณ  ์ธ๋ผ์ธ ์š”์†Œ๋Š” ํ•œ ์ค„์— ์ฐจ๋ก€๋Œ€๋กœ ๋ฐฐ์น˜๋œ๋‹ค.
์ •์  ์œ„์น˜ ์„ค์ •์„ ์‚ฌ์šฉํ•˜๋ฉด ์š”์†Œ์˜ ์œ„์น˜๋Š” top, bottom, left, right ์†์„ฑ์˜ ์˜ํ–ฅ์„ ๋ฐ›์ง€ ์•Š๋Š”๋‹ค.

๊ธฐ๋ณธ์ ์œผ๋กœ๋Š” static์œผ๋กœ ์„ค์ •๋˜์–ด ์žˆ๋‹ค.
Default value. Elements render in order, as they appear in the document flow.

position=static;

position์„ static์œผ๋กœ ์„ ์–ธํ•˜๋ฉด ๋ฌธ์„œ์˜ ์ •์ƒ์ ์ธ ํ๋ฆ„์— ๋”ฐ๋ผ์„œ ๋ฐฐ์น˜๋œ๋‹ค. static์œผ๋กœ ์„ ์–ธํ•˜์ง€ ์•Š๋Š” ๊ฒƒ๊ณผ ๊ฒฐ๊ณผ๋Š” ๊ฐ™๋‹ค.


2.2 ์ƒ๋Œ€ ์œ„์น˜ ์„ค์ • (Relative positioning)

relative: having meaning or significance only in relation to something elsenot absolute

์ •์ƒ์ ์ธ ์œ„์น˜์—์„œ ์ƒ๋Œ€์ ์œผ๋กœ ์š”์†Œ๊ฐ€ ๋ฐฐ์น˜๋˜๋Š” ๋ฐฉ๋ฒ•์ด๋‹ค. ์ •์ƒ์ ์ธ ์œ„์น˜๊ฐ€ ๊ธฐ์ค€์ ์ด ๋œ๋‹ค.
์ƒ๋Œ€ ์œ„์น˜์—์„œ ์ฃผ์˜ํ•  ์ ์€ ์š”์†Œ์˜ ์ •์ƒ์ ์ธ ์œ„์น˜์— ๋Œ€ํ•˜์—ฌ ์ƒ๋Œ€์ ์ด๋ผ๋Š” ์ ์ด๋‹ค. ์ƒ๋Œ€ ์œ„์น˜๋กœ ์„ค์ •๋œ ์š”์†Œ๋Š” ๋‹ค๋ฅธ ์š”์†Œ ์œ„์— ๋‹ค๋ฅธ ์š”์†Œ ์œ„์— ๊ฒน์ณ์ง€๊ฑฐ๋‚˜ ์ด๋™๋  ์ˆ˜ ์žˆ๋‹ค. ํ•˜์ง€๋งŒ ์š”์†Œ๋ฅผ ์œ„ํ•ด ํ• ๋‹น๋œ ์ •์ƒ์ ์ธ ๊ณต๊ฐ„์€ ์—†์–ด์ง€์ง€ ์•Š๋Š”๋‹ค. 

The element is positioned relative to its normal position, so "left:20px" adds 20 pixels to the element's LEFT position.

์˜ˆ์‹œ)

#one{background-color:cyan; width:200px; height:50px;}
#two{background-color:yellow; left:30px; width:200px; height:50px;
position:relative;}
#three{background-color:lightgreen; width:200px; height:50px;}

<p id="one">block #1</p>

<div id="two">
block #2 left: 30px; <br>
position: relative; 
	
<p id = "three">block #3</p>

๊ฒฐ๊ณผ) ๋…ธ๋ž€์ƒ‰ ๋ธ”๋ก์€ ์›๋ž˜์˜ ์ •์ƒ์ ์ธ ์œ„์น˜์—์„œ ์˜ค๋ฅธ์ชฝ์œผ๋กœ 30ํ”ฝ์…€๋งŒํผ ์ด๋™๋œ ๊ฒƒ์ด๋‹ค. 


2.3 ์ ˆ๋Œ€ ์œ„์น˜ ์„ค์ • (Absolute positioning)

Absolute: viewed or existing independently and not in relation to other thingsnot relative or comparative

์ „์ฒด ํŽ˜์ด์ง€๋ฅผ ๊ธฐ์ค€์œผ๋กœ ๋ฐฐ์น˜ํ•˜๋Š” ๋ฐฉ๋ฒ•์ด๋‹ค. ์ฆ‰ ํŽ˜์ด์ง€์˜ ์‹œ์ž‘ ์œ„์น˜์—์„œ top, left, bottom, right ๋งŒํผ ๋–จ์–ด์ง„ ์œ„์น˜์— ๋ฐฐ์น˜๋œ๋‹ค. (์ปจํ…Œ์ด๋„ˆ์˜ ์›์ ์ด ๊ธฐ์ค€์ ์ด ๋œ๋‹ค. ์ปจํ…Œ์ด๋„ˆ์—์„œ ๊ณ ์ •๋œ ์œ„์น˜์— ๋ฐฐ์น˜๋œ๋‹ค.)
๋ธ”๋ก 1๊ณผ ์ƒ๊ด€์—†๋‹ค.
The element is positioned relative to its first positioned (not static) ancestor element.

์ ˆ๋Œ€ ์œ„์น˜๋กœ ์„ค์ •๋œ ์š”์†Œ๋Š” ๋ฌธ์„œ์˜ ์ •์ƒ์ ์ธ ํ๋ฆ„์—์„œ ์ œ๊ฑฐ๋˜๊ณ  ํŽ˜์ด์ง€ ์•ˆ์˜ ๊ณ ์ •๋œ ์œ„์น˜์— ํ‘œ์‹œ๋œ๋‹ค.
๋˜ top, left, bottom, right ์†์„ฑ์€ ๋ชจ๋‘ ์˜คํ”„์…‹(offset)์œผ๋กœ ์ƒ๊ฐํ•ด์•ผ ํ•œ๋‹ค. 
In computer science, an offset within an array or other data structure object is an integer indicating the distance between the beginning of the object and a given element or point.

์ฆ‰ right 2px์€ ์˜ค๋ฅธ์ชฝ์œผ๋กœ 2px๋งŒํผ ์ด๋™ํ•˜๋ผ๋Š” ์˜๋ฏธ๊ฐ€ ์•„๋‹ˆ๊ณ  ํŽ˜์ด์ง€์˜ ์˜ค๋ฅธ์ชฝ ๊ฒฝ๊ณ„์„ ์—์„œ 2px๋งŒํผ ๋–จ์–ด์ง„ ์œ„์น˜๋ผ๋Š” ์˜๋ฏธ์ด๋‹ค. 
์˜ˆ์‹œ 1)
์•ž์˜ ์ฝ”๋“œ์—์„œ id="two"์ธ ๋ธ”๋ก์„ absolute๋กœ ์ง€์ •ํ•˜๊ณ  top, left ์†์„ฑ์—์„œ 30px๋ฅผ ์ง€์ •ํ•˜์—ฌ ๋ณธ๋‹ค. 

#one{background-color:cyan; width:200px; height:80px;}
#two{background-color:yellow; top:30px; left:30px; width:200px; height:80px;
position:absolute;}
#three{background-color:lightgreen; width:200px; height:80px;}

<div id="two">
block #2 <br>
position: absolute; <br>
top: 30px, left: 30px; 
</div>

<p id = "three">block #3</p>

๊ฒฐ๊ณผ) id="two"์ธ ๋ธ”๋ก์€ ํŽ˜์ด์ง€์˜ ์‹œ์ž‘ ์œ„์น˜๋ถ€ํ„ฐ (30,30)๋งŒํผ ๋–จ์–ด์ง„ ์œ„์น˜์— block #2๊ฐ€ ๋ฐฐ์น˜๋œ๋‹ค. 
The element is positioned relative to its first positioned (not static) ancestor element.


์˜ˆ์‹œ 2) ๋งŒ์•ฝ ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์žˆ๋‹ค๋ฉด ์ปจํ…Œ์ด๋„ˆ์— ์ƒ๋Œ€์ ์œผ๋กœ ๋ฐฐ์น˜๋œ๋‹ค. ์ฆ‰, ์ปจํ…Œ์ด๋„ˆ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์œ„์น˜๋ฅผ ์žก๋Š”๋‹ค.
์ฆ‰ ์ปจํ…Œ์ด๋„ˆ์˜ ์‹œ์ž‘ ์œ„์น˜๋กœ๋ถ€ํ„ฐ top, left, bottom, right ๋งŒํผ ๋–จ์–ด์ง„ ์œ„์น˜์— ๋ฐฐ์น˜๋œ๋‹ค.
์ปจํ…Œ์ด๋„ˆ๋Š” ์ผ๋ฐ˜์ ์œผ๋กœ relative๋กœ ์„ ์–ธ๋˜์–ด์•ผ ํ•œ๋‹ค. static์œผ๋กœ ์„ ์–ธ๋˜๋ฉด ์•ˆ ๋œ๋‹ค.

#one{background-color:cyan; width:200px; height:80px;}
#two{background-color:yellow; top:30px; left:30px; width:200px; height:80px;
position:absolute;}
#three{background-color:lightgreen; width:200px; height:80px;}
#container{background-color:gray; width:auto; height:80px;
position:relative;}

<p id="one">block #1</p>

<div id="container">
container<br>
<div id="two">
block #2 <br>
position: absolute; <br>
top: 30px, left: 30px; 
</div>
</div>

<p id = "three">block #3</p>

๊ฒฐ๊ณผ)


2.4 ๊ณ ์ • ์œ„์น˜ ์„ค์ • (Fixed positioning) p. 201

๋ธŒ๋ผ์šฐ์ € ์œˆ๋„์šฐ์— ์ƒ๋Œ€์ ์œผ๋กœ ์š”์†Œ์˜ ์œ„์น˜๋ฅผ ์žก๋Š” ๊ฒƒ์ด๋‹ค.
๋งŒ์•ฝ ์œˆ๋„์šฐ๊ฐ€ ์Šคํฌ๋กค๋œ๋‹ค๊ณ  ํ•˜์—ฌ๋„ ํ™”๋ฉด์—์„œ ์š”์†Œ๋Š” ์›€์ง์ด์ง€ ์•Š๋Š”๋‹ค. 
ex) ๊ฐ™์€ ํ‘œ์‹œ์—์„œ ํ‘œ์‹œ๋˜๋ฉด์„œ ๊ท€์ฐฎ๊ฒŒ ํ•˜๋Š” ์ชฝ์ง€

๊ณ ์ • ์œ„์น˜ ์š”์†Œ๋Š” ๋‹ค๋ฅธ ์š”์†Œ์™€ ์ค‘์ฒฉ๋  ์ˆ˜ ์žˆ๋‹ค. ๋‹ค๋ฅธ ์š”์†Œ๋Š” ๊ณ ์ • ์œ„์น˜ ์š”์†Œ๊ฐ€ ์—†๋Š” ๊ฒƒ์ฒ˜๋Ÿผ ๋ฐฐ์น˜๋œ๋‹ค.
์ ˆ๋Œ€ ์œ„์น˜๋Š” ์ปจํ…Œ์ด๋„ˆ์—์„œ ๊ณ ์ •๋œ ์œ„์น˜์— ๋ฐฐ์น˜๋˜๋Š” ๋ฐ˜๋ฉด ๊ณ ์ • ์œ„์น˜๋Š” ํ˜„์žฌ ์œˆ๋„์šฐ์—์„œ ๊ณ ์ •๋œ ์œ„์น˜์— ๋ฐฐ์น˜๋œ๋‹ค.

position: fixed;

The element is positioned relative to the browser window.


๋ถ๋งˆํฌ

<a id="์ด๋™์œ„์น˜์ด๋ฆ„"> ์ด๋™ํ•  ์œ„์น˜</a>
<a href="#์ด๋™์œ„์น˜์ด๋ฆ„"> Click! </a>


๋งํฌ ์ง€์ •ํ•  ๋•Œ

<a id = gotop href="#goingtop">TOP</a>

 

ํ˜•ํƒœ๋กœ id๋„ ๋„ฃ์„ ์ˆ˜ ์žˆ๋‹ค. 

์˜ˆ์‹œ)

<style type="text/css">
p{background-color:lightgreen; width:200px; height:50px;}
/* ํด๋ฆญ์„ ๋ฒ„ํŠผ์œผ๋กœ ๋ฐ”๊ฟ”์•ผํ•จ */
#gotop{background-color:grey; position:fixed; bottom:0px; right:0px; width:50px;} 
</style>


<body>
<a id="goingtop"></a>
<p>block #1</p>
<p>block #2</p>
<p>block #3</p>
<p>block #4</p>
<p>block #5</p>
<p>block #6</p>
<p>block #7</p>
<p>block #8</p>
<p>block #9</p>
<p>block #10</p>
<p>block #11</p>
<p>block #12</p>
<p>block #13</p>
<p>block #14</p>
<p>block #15</p>
<a id = gotop href="#goingtop">TOP</a>
</body>

๊ฒฐ๊ณผ)


float ์†์„ฑ p. 203


"position: static"์˜ ๋ธ”๋ก ์š”์†Œ์— ์‚ฌ์šฉ๋œ๋‹ค.  p. 212
์ด ์†์„ฑ์ด ์‚ฌ์šฉ๋˜๋ฉด ์ปจํ…Œ์ด๋„ˆ ์•ˆ ๋‹ค๋ฅธ ์š”์†Œ๊ฐ€ ์ด ์š”์†Œ๋ฅผ ๊ฐ์‹ธ๋ฉด ๋ฐฐ์น˜๋œ๋‹ค.
(์ด ์†์„ฑ์ด ์‚ฌ์šฉ๋˜๋ฉด position๊ณผ offset ์„ค์ •์€ ๋ชจ๋‘ ๋ฌด์‹œ๋œ๋‹ค.)

float๋œ ์š”์†Œ๋Š” ๋ถ€๋ชจ ์ปจํ…Œ์ด๋„ˆ์˜ ๊ฐ€์žฅ ์™ผ์ชฝ์ด๋‚˜ ๊ฐ€์žฅ ์˜ค๋ฅธ์ชฝ์œผ๋กœ ์ด๋™ํ•œ๋‹ค. float๋œ ์š”์†Œ ํ›„์— ์ถ”๊ฐ€๋˜๋Š” ์š”์†Œ๋Š” float ์š”์†Œ๋ฅผ ๊ฐ์‹ธ๋ฉด์„œ ๋ฐฐ์น˜๋œ๋‹ค. float๋œ ์š”์†Œ ์ด์ „์— ์ถ”๊ฐ€๋œ ์š”์†Œ๋Š” float ์˜ํ–ฅ์„ ๋ฐ›์ง€ ์•Š๋Š”๋‹ค.
float ์†์„ฑ์œผ๋กœ๋Š” ์š”์†Œ๋ฅผ ์ปจํ…Œ์ด๋„ˆ์˜ ์™ผ์ชฝ์ด๋‚˜ ์˜ค๋ฅธ์ชฝ์œผ๋กœ๋งŒ ๋ฐฐ์น˜๋  ์ˆ˜ ์žˆ๋‹ค. ์œ„์ชฝ์ด๋‚˜ ์•„๋ž˜์ชฝ์œผ๋กœ floatํ•  ์ˆ˜๋Š” ์—†๋‹ค. 

float: left 
float: right 
clear:both


clear:both: clear๋Š” float์˜ ํ๋ฆ„์„ ์ œ๊ฑฐํ•˜๋Š” ์†์„ฑํ•˜๋‹ค. 
ex) footer๊ฐ€ nav์™€ article ๋ฐ‘์œผ๋กœ ๊ฐ€๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•ด ์“ด๋‹ค.


z-index p. 207

์š”์†Œ๊ฐ€ ์ •์ƒ์ ์ธ ํ๋ฆ„์—์„œ ๋ฒ—์–ด๋‚˜์„œ ๋ฐฐ์น˜๋˜๋Š” ๊ฒฝ์šฐ์— ํ”ํžˆ ๊ฒน์นจ์ด ๋ฐœ์ƒํ•œ๋‹ค. 
z-index ์†์„ฑ์€ ์š”์†Œ์˜ ์Šคํƒ ์ˆœ์„œ (์ฆ‰ ์š”์†Œ๊ฐ€ ๋‹ค๋ฅธ ์š”์†Œ์˜ ์•ž์— ์œ„์น˜ํ•˜๋Š๋ƒ, ๋’ค์— ์œ„์น˜ํ•˜๋Š๋ƒ)๋ฅผ ์ง€์ •ํ•œ๋‹ค.
์š”์†Œ๋Š” ์–‘์ˆ˜ ํ˜น์€ ์Œ์ˆ˜์˜ ์Šคํƒ ์ˆœ์–ด๋ฅผ ๊ฐ€์งˆ ์ˆ˜ ์žˆ๋‹ค. (ex. -1, 0, 1, 2)

z๊ฐ’์ด ํด์ˆ˜๋ก ์•ž์— ๋†“์—ฌ์ง„๋‹ค. (ex. z-index: 200; > z-index: 100; > z-index: 0;)


์›น ํŽ˜์ด์ง€ ๋ ˆ์ด์•„์›ƒ์€ ์›น ์‚ฌ์ดํŠธ๋ฅผ ๋ณด๊ธฐ ์ข‹๊ฒŒ ํ•˜๋Š”๋ฐ ๊ฒฐ์ •์ ์ธ ์—ญํ• ์„ ํ•œ๋‹ค.
์›น ์‚ฌ์ดํŠธ์˜ ๋ ˆ์ด์•„์›ƒ์„ ๋งŒ๋“œ๋Š” ๋ฐฉ๋ฒ•์—๋Š” ์•„๋ž˜ 3๊ฐ€์ง€ ๋ฐฉ๋ฒ•์ด ์žˆ๋‹ค.

3. <div> ์š”์†Œ๋ฅผ ์ด์šฉํ•œ ๋ ˆ์ด์•„์›ƒ p. 213

์š”์†Œ๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์š”์†Œ์˜ ์œ„์น˜๋ฅผ ์ง€์ •ํ•ด์„œ ๋ ˆ์ด์•„์›ƒ์„ ๋งŒ๋“œ๋Š” ๋ฐฉ๋ฒ•์ด๋‹ค. ํ˜„์žฌ ๊ฐ€์žฅ ๋„๋ฆฌ ์‚ฌ์šฉ๋˜๊ณ  ์žˆ๋‹ค. ๋ธ”๋ก ์ˆ˜์ค€์˜ ์š”์†Œ๋กœ์„œ ๋‹ค๋ฅธ ์š”์†Œ๋ฅผ ๊ทธ๋ฃนํ•‘ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋œ๋‹ค. CSS๋ฅผ ์‚ฌ์šฉํ•ด ์š”์†Œ์˜ ์œ„์น˜๋ฅผ ์žก๊ณ  ๋ฐฐ๊ฒฝ์ด๋‚˜ ์ƒ‰์ƒ์„ ์ง€์ •ํ•œ๋‹ค. 

๋ฐฉ๋ฒ•
1) div id="wrapper"๋กœ ์ „์ฒด๋ฅผ ๋ฌถ๋Š”๋‹ค. ๊ฐ๊ฐ์˜ div๋ฅผ ์ง€์ •ํ•œ๋‹ค ex) div id = "header", div id = "nav", div id = "content", div id = "footer"

2) float: left, float: right๋ฅผ ์ด์šฉํ•ด์„œ nav๋ฅผ ์™ผ์ชฝ, content๋ฅผ ์˜ค๋ฅธ์ชฝ์œผ๋กœ css์—์„œ ์ง€์ •ํ•œ ํฌ๊ธฐ๋งŒํผ ๋ฐฐ์น˜ํ•˜๊ณ 
footer์— clear: both๋ฅผ ์“ด๋‹ค. 

4. ์˜๋ฏธ์  ์š”์†Œ(Semantic elements)๋ฅผ ์ด์šฉํ•œ ๋ ˆ์ด์•„์›ƒ p.216

์ตœ๊ทผ์— HTML์— ์ถ”๊ฐ€๋œ ์—ฌ๋Ÿฌ ๊ฐ€์ง€ ์‹œ๋งจํ‹ฑ ์š”์†Œ๋ฅผ ์ด์šฉํ•˜์—ฌ ๋ ˆ์ด์•„์›ƒ์„ ์žก๋Š” ๋ฐฉ๋ฒ•์ด ์‹œ๋„๋˜๊ณ  ์žˆ๋‹ค. ๊ทผ๋ณธ์ ์œผ๋กœ๋Š” div ์š”์†Œ์™€ ์œ ์‚ฌํ•œ ๋ฐฉ๋ฒ•์ด๋‹ค. 
<div id="header"> ๋Œ€์‹ ์— <header> ๊ฐ™์€ ๋” ์ง๊ด€์ ์ธ ํƒœ๊ทธ๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.

์ข…๋ฅ˜

1. header: ๋ฌธ์„œ์˜ ๋จธ๋ฆฌ๋ง
2. nav: ๋‚ด๋น„๊ฒŒ์ด์…˜ ๋งํฌ
3. section: ๋ฌธ์„œ์˜ ์„น์…˜ 
4. article: ๋ฌธ์„œ์˜ ๋‚ด์šฉ, ๋ธ”๋กœ๊ทธ์˜ ํฌ์ŠคํŠธ์ด๋‹ค. ์„น์…˜ ๋ฐ‘์œผ๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ๋‹ค. 
5. footer: ๋ฌธ์„œ์˜ ๊ผฌ๋ฆฌ๋ง
6. figure: ๊ทธ๋ฆผ์ด๋‚˜ ๋„ํ‘œ. ๋…๋ฆฝ์ ์ธ ์ฝ˜ํ…์ธ ๋ฅผ ํ‘œํ˜„ํ•œ๋‹ค. <figcaption> ์š”์†Œ๋ฅผ ์‚ฌ์šฉํ•ด ๊ทธ๋ฆผ์˜ ์„ค๋ช…์„ ๋ง๋ถ™์ผ ์ˆ˜ ์žˆ๋‹ค.|
7. hgroup: h1์—์„œ h6 ์š”์†Œ์˜ ๊ทธ๋ฃน
8. aside: ์‚ฌ์ด๋“œ ๋ฐ”์™€ ๊ฐ™์ด ์˜†์— ์œ„์น˜ํ•˜๋Š” ๋‚ด์šฉ
9. time: ๋‚ ์งœ์™€ ์‹œ๊ฐ„์„ ํ‘œ์‹œํ•œ๋‹ค.


* ํ…Œ์ด๋ธ”(display: table, display: table-cell)์„ ์ด์šฉํ•œ ๋ ˆ์ด์•„์›ƒ

๊ฐ€์žฅ ์ „ํ†ต์ ์ธ ๋ฐฉ๋ฒ•์ด๊ณ  ๊ฒฝ์šฐ์— ๋”ฐ๋ผ์„œ๋Š” ์•„์ฃผ ํŽธ๋ฆฌํ•œ ๋ฐฉ๋ฒ•์ด์ง€๋งŒ ํ…Œ์ด๋ธ”์˜ ์›๋ž˜ ์šฉ๋„์™€๋Š” ์–ด๊ธ‹๋‚œ๋‹ค.
์ด ์ฑ…์—์„œ๋Š” ๋‹ค๋ฃจ์ง€ ์•Š๋Š”๋‹ค.


ํ…Œ์ด๋ธ”(display: table, display: table-cell)์„ ์ด์šฉํ•œ ๋ ˆ์ด์•„์›ƒ์˜ ์žฅ์  p.221

- ํ…Œ์ด๋ธ” ํ˜•ํƒœ๋กœ ๋ ˆ์ด์•„์›ƒํ•˜๋Š” ๋ฐ float๋‚˜ ์ ˆ๋Œ€ ์œ„์น˜ ์„ค์ •์ด ํ•„์š”ํ•˜์ง€ ์•Š๋‹ค.
- ์นผ๋Ÿผ์˜ ๋†’์ด๊ฐ€ ๋‹ฌ๋ผ๋„ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋Š”๋‹ค.
- CSS ์ฝ”๋”ฉ์ด ๊ฐ„๊ฒฐํ•ด์ง„๋‹ค.
- IE8+๋ฒ„์ „, Firefox, Chrome, Safari, Opera๊ฐ€ ๋ชจ๋‘ ์ง€์›ํ•œ๋‹ค.



๊ต์žฌ p.217์˜ ํ™ˆํŽ˜์ด์ง€ ๋งŒ๋“ค๊ธฐ ์˜ˆ์ œ๋ฅผ ํ•  ๋•Œ ์ง์ ‘ ์ฝ”๋“œ ์•ˆ ๋ณด๊ณ  ๋งŒ๋“ค์—ˆ๋Š”๋ฐ ๊ต์žฌ์˜ ์ •๋‹ต๊ณผ ๋‚ด๊ฐ€ ๋งŒ๋“  ๊ฒƒ์˜ ์ฐจ์ด์ ์€ 
๊ต์žฌ์—์„œ๋Š”
- <style>์— ์œ„์น˜ํ•œ section#main{}๊ณผ nav{}์— display:table-cell์„ ๋„ฃ์—ˆ๋‹ค. 

- <body>๋ฅผ ๊ฐ€์žฅ ์šฐ์„ ์ ์œผ๋กœ ์‚ฌ์šฉํ•ด์„œ ๋ชจ๋“  ์š”์†Œ๋“ค์„ ํฌ๊ด„ํ–ˆ๋‹ค. 
- <section id="main"> ๋ฐ‘์— <article>์„ 2๊ฐœ์”ฉ ๋‘์—ˆ๋‹ค.
- <nav> ๋ฐ‘์— <figure>์„ ์ผ๊ณ , <figcaption>์„ ์ด์šฉํ•ด์„œ ์บก์…˜์„ ๋‹ฌ์•˜๋‹ค.
๊ทธ ์™ธ๋Š” ๋Œ€๋ถ€๋ถ„ ๊ฐ™์•˜๋‹ค.

๊ต์žฌ ์ •๋‹ต์„ ๋ณด๊ธฐ ์ „์— float:left, float:right๋ฅผ ์‚ฌ์šฉํ–ˆ๋Š”๋ฐ, ๊ต์žฌ์˜ ๋ง๋กœ๋Š” ์นผ๋Ÿผ์˜ ๋†’์ด๊ฐ€ ๋‹ค๋ฅผ ๊ฒฝ์šฐ ๋ฐฐ๊ฒฝ์ƒ‰์ด ์žˆ์„ ์‹œ ๊ฒฐ๊ณผ๊ฐ€ ์–ด์ƒ‰ํ•ด ๋ณด์ด๋ฏ€๋กœ display:table-cell์„ ์“ฐ๋ผ๊ณ  ํ•œ๋‹ค.


์ง์ ‘ ์“ด ์ฝ”๋“œ๋กœ ๋งŒ๋“  ๊ฒฐ๊ณผ)

๊ต์žฌ์˜ ์˜ˆ์‹œ ์‚ฌ์ง„๊ณผ ๋‹ค๋ฅด๊ฒŒ ํŒจ๋”ฉ ์„ค์ •์„ ๋ชปํ–ˆ๊ณ , ์‚ฌ์ง„ ์ž์ฒด์— <figure>, <figcaption>์„ ์‚ฌ์šฉ ์•ˆ ํ–ˆ๋‹ค. 

๊ต์žฌ ์˜ˆ์‹œ) 

body{font-family:Arial,"Trebuchet MS",sans-sefif;margin:0px;}
header{background-color:lavender; font-weight: bold; font-size:35px;
text-align:center; text-transform: capitalize;
height:50px; margin:0px; padding: 5px;}
h1{margin:0px;}
section#main{display:table-cell; background-color:yellow; padding:15px;  width:80%;}
nav{display:table-cell;background-color:orange; font-weight: bold;
padding: 15px; font-size:25px; width:20%;}
footer{background-color:brown;color:white; text-align:center;
padding: 10px; margin: 0px;}
div { text-align: center; }

<header>My blog page</header>

<nav>
<h1>Links</h1>
<ul>
<li><a href="http://www.google.com">W3C</a></li>
<li><a href="http://www.google.com">MOZILLA</a></li>
<li><a href="http://www.google.com">HTML Dogs</a></li>
</ul>
<div><figure><img src="image/coffee.webp" width=40%; alt="ํ™๊ธธ๋™">
<figcaption>ํ™๊ธธ๋™</figcaption></figure></div>
</nav>

<section id="main">
<article>
<h1>Semantic Tags</h1>
<p>์‹œ๋งจํ‹ฑ ์š”์†Œ(Semantic elements)๋“ค์€ ๋ธŒ๋ผ์šฐ์ €์—๊ฒŒ ์š”์†Œ์˜ ์˜๋ฏธ๋‚˜ ๋ชฉ์ ์„ ๋ช…ํ™•ํ•˜๊ฒŒ ์•Œ๋ ค์ฃผ๋Š” ์š”์†Œ์ž…๋‹ˆ๋‹ค.</p>
<h1>div์™€ span</h1>
<p>div์€ "divide"์˜ ์•ฝ์ž๋กœ์„œ ํŽ˜์ด์ง€๋ฅผ ๋…ผ๋ฆฌ์ ์ธ ์„น์…˜์œผ๋กœ ๋ถ„๋ฆฌํ•˜๋Š”๋ฐ ์‚ฌ์šฉ๋˜๋Š” ํƒœ๊ทธ์ด๋‹ค. span ์š”์†Œ๋Š” ์ธ๋ผ์ธ ์š”์†Œ๋กœ์„œ
ํ…์ŠคํŠธ๋ฅผ ์œ„ํ•œ ์ปจํ…Œ์ด๋„ˆ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.</p>
</article>
</section>

<footer>Copyright (c) 2013 Hong</footer>

๊ต์žฌ์˜ ์ •๋‹ต์˜ ๊ฒฐ๊ณผ)

ํŒจ๋”ฉ ์„ค์ •์ด ๋ผ์„œ ๊น”๋”ํ•˜๋‹ค. 
์‹ค์ œ๋กœ ์›นํŽ˜์ด์ง€ ๋งŒ๋“ค ๋•Œ ์ „์ฒด ๋ฐฐ๊ฒฝ์ƒ‰์„ ํฐ์ƒ‰์œผ๋กœ ํ•˜๋ผ๊ณ  ํ•œ๋‹ค. 


5.  ํšจ๊ณผ p. 221

์ „ํ™˜ (Transition) 

: ํ•˜๋‚˜์˜ ํ˜•ํƒœ์—์„œ ๋‹ค๋ฅธ ํ˜•ํƒœ๋กœ ๋ณ€ํ™”ํ•˜๋Š” ํšจ๊ณผ์ด๋‹ค.
ํ•˜๋‚˜์˜ ์Šคํƒ€์ผ์—์„œ ๋‹ค๋ฅธ ์Šคํƒ€์ผ๋กœ ์ ์ง„์ ์œผ๋กœ ๋ณ€ํ™”ํ•œ๋‹ค. 
(์ „ํ™˜์˜ ๋Œ€์ƒ์ด ๋˜๋Š” ์†์„ฑ, ์ „ํ™˜ ํšจ๊ณผ์˜ ์ง€์† ์‹œ๊ฐ„์„ ๋‚˜ํƒ€๋‚ธ๋‹ค.)

transition: width 5s;

6. CSS3 ๋ณ€ํ™˜ (Transformation) p.226 

- ํ‰ํ–‰์ด๋™

transform: translate(10px, 10px)

 

 - ํšŒ์ „

transform: rotate(45deg)

 

 - ํฌ๊ธฐ ๋ณ€ํ™˜

transform: scale(2, 1.2)

 

 - ๋น„ํ‹€๊ธฐ ๋ณ€ํ™˜

transform: skew(20deg, 10deg)

 

 - ์ผ๋ฐ˜์ ์ธ ๋ณ€ํ™˜

transform: matrix()


๋ชจ๋“  2D transform ๋ฉ”์„œ๋“œ๋ฅผ ํ•œ ์ค„์— ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ค€๋‹ค. ๋งค๊ฐœ๋ณ€์ˆ˜ ์ˆœ์„œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

matrix(scaleX(), skewY(), skewX(), scaleY(), translateX(), translateY());


์ถœ์ฒ˜: http://www.tcpschool.com/css/css3_transform_2Dtransform

 

์—ฌ๋Ÿฌ ๊ฐœ ์‚ฌ์šฉํ•  ๋• ์•„๋ž˜์ฒ˜๋Ÿผ ํ•œ ์นธ์„ ๋„์–ด์„œ ์‚ฌ์šฉํ•œ๋‹ค. 

transform:translate(80px, 80px) scale(1.5, 1.5)

 

์˜ˆ์‹œ)

<style type="text/css">
div{width:50px; height:50px; background:red; border:1px solid black; text-align:center;}
div#box2{transform:translate(100px,0);background:orange;} /*x์ถ• 100px, y์ถ• 0๋งŒํผ ์ด๋™*/
div#box3{transform:scale(1.2,1.2); background-color:yellow;} /*๊ฐ€๋กœ 1.2, ์„ธ๋กœ 1.2 ํ™•๋Œ€*/
div#box4{transform:rotate(30deg); background-color:green; color: white;} /*x์ถ•์„ 30๋„ ๋งŒํผ ํšŒ์ „*/
div#box5{transform:skew(30deg,20deg); background-color:blue; color: white;} /*x์ถ•์„ 30๋„ ๋งŒํผ ํšŒ์ „, y์ถ•์„ 20๋„ ๋งŒํผ ํšŒ์ „*/
div#box6{transform:translate(80px, 80px) scale(1.5, 1.5) rotate(45deg);
height:100px; width:100px; background-color:navy; color: white;} 
</style>

<body>
<div id="box1">Box1</div>
<div id="box2">Box2</div>
<div id="box3">Box3</div>
<div id="box4">Box4</div>
<div id="box5">Box5</div>
<div id="box6">Box6</div>
</body>

๊ฒฐ๊ณผ)

 


7. CSS3 3์ฐจ์› ๋ณ€ํ™˜ p. 231

ํ›„๋ฉด์„ ๋ณด์ด๊ฒŒ ํ•˜๋Š” ์†์„ฑ์ด๋‹ค.

backface-visibility: visible;


๋ณ€ํ™˜ ์›์  ์„ค์ •ํ–ˆ๋‹ค.

transform-origin: 50% 42%;


์›๊ทผ ๋ณ€ํ™˜์—์„œ ๊ฑฐ๋ฆฌ, Y์ถ•, X์ถ•์„ ์ค‘์‹ฌ์œผ๋กœ ํ•˜๋Š” ๋ณ€ํ™˜์ด๋‹ค.

transform: perspective(500px) rotateY(59deg) rotateX(0deg);

 

์˜ˆ์‹œ)

div{background-color:green; height:150px; width:150px}
.container{background-color:yellow; border: 1px solid black;}
.transformed{backface-visibility:visible; transform-origin:50% 42%; 
transform:perspective(500px) rotateY(59deg) rotateX(0deg);}

<div class="container">
<div class="transformed"></div>
</div>

๊ฒฐ๊ณผ)


8. CSS3 ์• ๋‹ˆ๋ฉ”์ด์…˜ p. 232 

8.1 @keyframes p.234

๊ธฐ๋ณธ๊ฐ’์€ static์ด๋ฏ€๋กœ relative๋กœ ๋ฐ”๊ฟ”์ค˜์•ผ ์›€์ง์ธ๋‹ค. 

position: relative;


์• ๋‹ˆ๋ฉ”์ด์…˜ ์ง€์† ์‹œ๊ฐ„๊ณผ ํ‚คํ”„๋ ˆ์ž„ ๊ทœ์น™ ์ด๋ฆ„: 2์ดˆ ์ง€์†

animation: 2s myanim;


์• ๋‹ˆ๋ฉ”์ด์…˜ ๋ฐ˜๋ณต ํšŸ์ˆ˜: 10๋ฒˆ ๋ฐ˜๋ณต

animation-iteration-count: 10;

 

ํ‚คํ”„๋ ˆ์ž„์˜ ์œ„์น˜๋Š” ํผ์„ผํŠธ๋กœ ์ง€์ •ํ•˜๋ฉฐ ๊ฐ ํ‚คํ”„๋ ˆ์ž„์—์„œ ์†์„ฑ์˜ ๊ฐ’์„ ์ง€์ •ํ•œ๋‹ค.
@keyframes myanim (ํ‚คํ”„๋ ˆ์ž„์„ ์ง€์ •ํ•œ๋‹ค. ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ด๋ฆ„์„ ์ง€์ •ํ•œ๋‹ค.)

์˜ˆ์‹œ)

@keyframes myanim{ 
0% {left: 0px; top: 0px; background-color:red} /*0์ดˆ*/
25% {left: 100px; top: 0px; background-color:red}
50% {left: 200px; top: 0px; background-color:yellow}
75% {left: 100px; top: 0px; background-color:blue}
100% {left: 0px; top: 0px; background-color:blue}/*2์ดˆ*/
}

8.2 ํŠ€์–ด ์˜ค๋ฅด๋Š” ๊ณต ์• ๋‹ˆ๋ฉ”์ด์…˜ p.235

์›€์ง์ž„์ด ๋ฉˆ์ถœ ๋•Œ ๋์— ์ด๋ฅด๋Ÿฌ ๋ณ€ํ™”์˜ ์ •๋„๊ฐ€ ์„œ์„œํžˆ ๊ฐ์†Œํ•˜๋Š” ๊ฒƒ. ๊ณต์˜ ์œ„์น˜๊ฐ€ ๋ฐ”๋‹ฅ์ด ๋œ๋‹ค.

webkit-animation-timing-function: east-out


์ฒœ์ฒœํžˆ ์‹œ์ž‘ํ•˜๋Š” ๊ฒƒ. ๊ณต์˜ ์œ„์น˜๋Š” ๋ฐ”๋‹ฅ์—์„œ ์„ค์ •ํ•œ npx๊ฐ€ ๋œ๋‹ค.

webkit-animation-timing-function: ease-in


์›์ฒ˜๋Ÿผ ๋ณด์ด๊ฒŒ๋” ๊ฒฝ๊ณ„์„ ์„ ๋‘ฅ๊ธ€๊ฒŒ ํ•œ๋‹ค. 

border-radius: 10px;



์˜ˆ์‹œ)

@-webkit-keyframes bounce{
from, to{bottom:0px; /*๊ณต์˜ ์œ„์น˜: ๋ฐ”๋‹ฅ*/
-webkit-animation-timing-function:ease-out;}

50%{bottom:200px; /*๊ณต์˜ ์œ„์น˜: ๋ฐ”๋‹ฅ์—์„œ 200px*/
-webkit-animation-timing-function:ease-in;}}

#ball{position: absolute; width: 20px; height: 20px; background: red; border-radius:10px;
-webkit-animation-name:bounce;
-webkit-animation-iteration-count:infinite;
-webkit-animation-duration:5s;}

<div id="ball"></div>

๊ธฐํƒ€

์ƒ‰์ƒ ์ฐธ๊ณ ํ•˜๋Š” ์‚ฌ์ดํŠธ:
https://developer.mozilla.org/ko/docs/Web/CSS/color_value

navigation ๊ฒ€์ƒ‰ ๋“ฑ ์•„๋ž˜ ์‚ฌ์ดํŠธ๊ฐ€ ๋„์›€์ด ๋œ๋‹ค.
https://codepen.io/

 

CodePen

An online code editor, learning environment, and community for front-end web development using HTML, CSS and JavaScript code snippets, projects, and web applications.

codepen.io


728x90
๋ฐ˜์‘ํ˜•

'๐ŸŒณBootcamp Revision 2023โœจ > HTML5, CSS3, JSP' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[56] 230320 JSP Ch. 1 ๋“ค์–ด๊ฐ€๊ธฐ, Ch. 2 ์›น ํ”„๋กœ๊ทธ๋ž˜๋ฐ ๊ธฐ์ดˆ, Ch. 13 ์ดํด๋ฆฝ์Šค๋ฅผ ์ด์šฉํ•œ ์›น ๊ฐœ๋ฐœ [K-๋””์ง€ํ„ธ ํŠธ๋ ˆ์ด๋‹ 56์ผ]  (0) 2023.03.20
[8] 230106 Ch. 7 HTML๊ณผ CSS๋กœ ์›น์‚ฌ์ดํŠธ ๋งŒ๋“ค๊ธฐ: ์›น ์‚ฌ์ดํŠธ ์ž‘์„ฑ, HTML ๋ฌธ์„œ ยท CSS ํŒŒ์ผ ์ž‘์„ฑํ•˜๊ธฐ, ์™„์„ฑ๋œ ํŽ˜์ด์ง€ ๋ณด๊ธฐ [K-๋””์ง€ํ„ธ ํŠธ๋ ˆ์ด๋‹ 8์ผ]  (0) 2023.01.06
[6] 230104 Ch. 5 CSS3 ๋ฐ•์Šค ๋ชจ๋ธ๊ณผ ์‘์šฉ: ๋ฐ•์Šค ๋ชจ๋ธ, ๊ฒฝ๊ณ„์„ , ๋งˆ์ง„๊ณผ ํŒจ๋”ฉ, ๋ฐฐ๊ฒฝ ์„ค์ •ํ•˜๊ธฐ, ๋งํฌ ยท ๋ฆฌ์ŠคํŠธ ยท ํ…Œ์ด๋ธ” ์Šคํƒ€์ผ [K-๋””์ง€ํ„ธ ํŠธ๋ ˆ์ด๋‹ 6์ผ]  (0) 2023.01.04
[5] 230103 Ch. 4 CSS3 ์Šคํƒ€์ผ ์‹œํŠธ ๊ธฐ์ดˆ: CSS ๊ฐœ๋…, ์„ ํƒ์ž, CSS๋ฅผ ์‚ฝ์ž…ํ•˜๋Š” ๋ฐฉ๋ฒ•, ์ƒ‰์ƒ, ํฐํŠธ, ํ…์ŠคํŠธ ์Šคํƒ€์ผ ์„ค์ • [K-๋””์ง€ํ„ธ ํŠธ๋ ˆ์ด๋‹ 5์ผ]  (0) 2023.01.03
Comments