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๐ŸŒณ๐Ÿ˜Š

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

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

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

yjyuwisely 2023. 1. 3. 12:50

230103 Tue 5th class

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

 

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

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

product.kyobobook.co.kr

 

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


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

- ์†Œํ”„ํŠธ์›จ์–ด์—์„œ์˜ ํ”„๋ ˆ์ž„์›Œํฌ๋Š” 'ํŠน์ • ํ”„๋กœ๊ทธ๋žจ์„ ๊ฐœ๋ฐœํ•˜๊ธฐ ์œ„ํ•œ ์—ฌ๋Ÿฌ ์š”์†Œ๋“ค๊ณผ ๋งค๋‰ด์–ผ์ธ ๋ฃฐ์„ ์ œ๊ณตํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ'์ด๋‹ค. 
ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ ๊ฐ€์ง€๊ณ  ํ”„๋กœ๊ทธ๋žจ์„ ๋งŒ๋“ค๊ธฐ ์‹œ์ž‘ํ•˜๋ฉด ์–ด๋–ค ๊ทœ์•ฝ์„ ๊ผญ ์ง€ํ‚ค๋ฉด์„œ ๋งŒ๋“ค์–ด์•ผ ํ•œ๋‹ค.

- ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” ์†Œํ”„ํŠธ์›จ์–ด๋ฅผ ๊ฐœ๋ฐœํ•˜๊ธฐ ์‰ฝ๊ฒŒ ์–ด๋–ค ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜๋Š” ๋„๊ตฌ๋“ค์ด๋‹ค.

์ฃผ์„ (Comment)

์ฃผ์„ (๋‚ฑ๋ง์ด๋‚˜ ๋ฌธ์žฅ์˜ ๋œป์„ ์‰ฝ๊ฒŒ ํ’€์ดํ•จ. ๋˜๋Š” ๊ทธ๋Ÿฐ ๊ธ€.) ๋˜๋Š” ์ฝ”๋ฉ˜ํŠธ(comment)
: ํ”„๋กœ๊ทธ๋žจ ์‹คํ–‰๊ณผ๋Š” ์ƒ๊ด€์—†์ด ์ฝ”๋“œ์— ์„ค๋ช…์„ ๋ถ™์ธ ๊ฒƒ์ด๋‹ค.
ํ”„๋กœ๊ทธ๋ž˜๋ฐ์— ์žˆ์–ด ๋‚ด์šฉ์„ ๋ฉ”๋ชจํ•˜๋Š” ๋ชฉ์ ์œผ๋กœ ์“ฐ์ธ๋‹ค. 
์ฃผ๋ชฉ์ ์€ ์†Œ์Šค ์ฝ”๋“œ๋ฅผ ๋” ์‰ฝ๊ฒŒ ์ดํ•ดํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋งŒ๋“œ๋Š” ๊ฒƒ์ด๋ฉฐ, ํ˜‘์—…ํ•  ๋•Œ ์œ ์šฉํžˆ ์“ฐ์ธ๋‹ค.

์ฃผ์„์„ ์‚ฌ์šฉํ•ด์„œ ์ผ๋ถ€ ์ฝ”๋“œ๊ฐ€ ์ ์šฉ ์•ˆ ๋˜๊ฒŒ ํ•  ์ˆ˜ ์žˆ๋‹ค.
HTML5: <!-- ๋‚ด์šฉ -->
CSS: /* ๋‚ด์šฉ */


 

Ch. 4 CSS3 ์Šคํƒ€์ผ ์‹œํŠธ ๊ธฐ์ดˆ

์ฑ…์˜ ๋ชฉ์ฐจ
-CSS์˜ ๊ฐœ๋…
-์„ ํƒ์ž
-CSS๋ฅผ ์‚ฝ์ž…ํ•˜๋Š” ๋ฐฉ๋ฒ•
-์ƒ‰์ƒ
-ํฐํŠธ
-ํ…์ŠคํŠธ ์Šคํƒ€์ผ ์„ค์ •

1. CSS(Cascading Style Sheets) ์˜ ๊ฐœ๋…

์ดˆ๊ธฐ๋ถ€ํ„ฐ HTML์€ ๋ฌธ์„œ์˜ ๊ตฌ์กฐ(๋‚ด์šฉ)๋ฅผ ์ •์˜ํ•˜๊ธฐ ์œ„ํ•ด์„œ ์ œ์ž‘๋˜์—ˆ๋‹ค.
CSS๋ฅผ ์ด์šฉํ•ด์„œ ๋ฌธ์„œ์˜ ์Šคํƒ€์ผ์„ ์ง€์ •ํ•œ๋‹ค.
์ตœ์‹  ๋ฒ„์ „์ธ HTML5์—์„œ๋Š” ๋ฌธ์„œ์˜ ์Šคํƒ€์ผ์€ ๋ฐ˜๋“œ์‹œ CSS์—์„œ ์ •์˜ํ•  ๊ฒƒ์„ ์ ๊ทน์ ์œผ๋กœ ๊ถŒ์žฅํ•˜๊ณ  ์žˆ๋‹ค. 


2. ์„ ํƒ์ž(selector) p.113

์„ ํƒ์ž๋ž€ HTML ์š”์†Œ๋ฅผ ์„ ํƒํ•˜๋Š” ๋ถ€๋ถ„์ด๋‹ค. 
ex) ์„ ํƒ์ž p , ์†์„ฑ color , ๊ฐ’ blue 

p { color : blue; }

๊ฐ’ ๋’ค์— ;์„ ๋ถ™์ธ๋‹ค. (์†์„ฑ์ด 1๊ฐœ ์ผ ๋•Œ๋Š” ์•ˆ ๋ถ™์—ฌ๋„ ๋œ๋‹ค.)
์•„๋ž˜๋Š” ๊ฐ€์žฅ ๋งŽ์ด ์‚ฌ์šฉ๋˜๋Š” ์„ ํƒ์ž 6๊ฐ€์ง€๋ฅผ ์ •๋ฆฌํ–ˆ๋‹ค.

 

2.1 ํƒ€์ž… ์„ ํƒ์ž

HTML ์š”์†Œ ์ด๋ฆ„์„ ์‚ฌ์šฉํ•œ๋‹ค.
ex) p ์š”์†Œ๋ฅผ ์„ ํƒํ•œ๋‹ค.

p{ color : red}



2.2 ์ „์ฒด ์„ ํƒ์ž (*)

*๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํŽ˜์ด์ง€ ์•ˆ ๋ชจ๋“  ์š”์†Œ๋ฅผ ์„ ํƒํ•œ๋‹ค.

 

2.3 ์•„์ด๋”” ์„ ํƒ์ž (#)

#๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค. ํ•˜๋‚˜์˜ ์š”์†Œ๋งŒ ์„ ํƒํ•  ์ˆ˜ ์žˆ๋‹ค.
๊ณ ์œ ๋ช…์‚ฌ์ด๋‹ค. ๋™์ผ ์ด๋ฆ„์€ ์•ˆ ๋œ๋‹ค.
ex)

#special{ color : red }

ex) <h1> ์š”์†Œ ์ค‘์—์„œ ์•„์ด๋””๊ฐ€ "special"์ธ ์š”์†Œ๋ฅผ ์„ ํƒํ•จ

h1#special { color : blue; }

 

2.4 ํด๋ž˜์Šค ์„ ํƒ์ž (. )

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

.target { color : red }

 

2.5 ์˜์‚ฌ (Pseudo) ํด๋ž˜์Šค (:) p. 119

: ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํ‘œ๊ธฐํ•œ๋‹ค. ํด๋ž˜์Šค๊ฐ€ ์ •์˜๋œ ๊ฒƒ์ฒ˜๋Ÿผ ๊ฐ„์ฃผํ•œ๋‹ค.
ex) a:link
<a> ์š”์†Œ์— ํด๋ž˜์Šค link๊ฐ€ ์„ ์–ธ๋œ ๊ฒƒ์ฒ˜๋Ÿผ ์ƒ๊ฐํ•˜๊ณ  ์„ ํƒ์ž๋ฅผ ๋งŒ๋“ ๋‹ค.

์˜์‚ฌ ํด๋ž˜์Šค๋Š” ๋ฌธ์„œ ํŠธ๋ฆฌ์˜ ์™ธ๋ถ€์— ์žˆ๋Š” ์ •๋ณด์— ๊ธฐ๋ฐ˜์„ ๋‘์–ด์„œ ์š”์†Œ๋ฅผ ์„ ํƒํ•  ๋•Œ ์‚ฌ์šฉ๋œ๋‹ค. 
ex) ํ•˜์ดํผ ๋งํฌ๊ฐ€ ๋ฐฉ๋ฌธ ์ „๊ณผ ๋ฐฉ๋ฌธ ํ›„์˜ ์ƒ‰์ƒ์„ ๋‹ค๋ฅด๊ฒŒ ํ•  ์ˆ˜ ์žˆ๋‹ค. 

<head>
<meta charset="UTF-8">
<title>์˜์‚ฌ ํด๋ž˜์Šค</title>
<style type = "text/css">
a:link{color:blue;text-decoration:none} /*์•„์ง ๋ฐฉ๋ฌธ๋˜์ง€ ์•Š์€ ๋งํฌ์˜ ์ƒ‰์ƒ์„ ํŒŒ๋ž‘์ƒ‰์œผ๋กœ ํ•œ๋‹ค.*/
a:visited{color:green;text-decoration:none} /*๋ฐฉ๋ฌธ๋œ ๋งํฌ์˜ ์ƒ‰์ƒ์€ ๋…น์ƒ‰์œผ๋กœ ํ•œ๋‹ค.*/
a:hover{color:red;text-decoration:underline} /*์‚ฌ์šฉ์ž๊ฐ€ ๋งํฌ ์œ„์— ์žˆ์„ ๋•Œ*/
</style>
</head>
<body>

 

์–ด๋–ค ์š”์†Œ์˜ n๋ฒˆ์งธ ์ž์‹ ์š”์†Œ๋„ ๋‚˜ํƒ€๋‚ผ ์ˆ˜ ์žˆ๋‹ค.

table:nth-child(2n+1){color:navy;}/*HTML ํ…Œ์ด๋ธ”์˜ ํ™€์ˆ˜ ๋ฒˆ์งธ ํ–‰*/
table:nth-child(2n+0){color:maroon;}/*HTML ํ…Œ์ด๋ธ”์˜ ์ง์ˆ˜ ๋ฒˆ์งธ ํ–‰*/

 

CSS ์ˆœ์„œ ์„ ํƒ์ž (nth-child)

nth-child

ํ™€์ˆ˜ํ˜•์ด๋‹ค.
์˜ˆ์‹œ)

li:nth-child(odd)



์ง์ˆ˜ํ˜•์ด๋‹ค.
์˜ˆ์‹œ)

li:nth-child(even)



๊ธฐ๋ณธ์ ์ธ ํ•จ์ˆ˜ํ˜•์ด๋‹ค.

nth-child(An+B)



๋‘ ๋ฒˆ์งธ๋งˆ๋‹ค ์„ ํƒํ•œ๋‹ค.

nth-child(2n)


์•ž์—์„œ๋ถ€ํ„ฐ 5๊ฐœ๋งŒ ์„ ํƒํ•œ๋‹ค.

nth-child(-n+5)

 

์˜ˆ์‹œ)

th{border: 1px solid black;font-weight: bold;}
td{border: 1px solid black;}
th{color:white; background-color:navy;}
tr:nth-child(odd) {background-color: lightyellow;}

<table>
<tr><th>์ด๋ฆ„</th>
  <th>์ด๋ฉ”์ผ</th></tr>
 
    <tr><td>Bill Russell</td>
    <td>br@gmail.com</td></tr>
    
    <tr><td>Sam Jones</td>
    <td>sj@gmail.com</td></tr>
    
    <tr><td>Tom Heinsohn</td>
    <td>th@gmail.com</td></tr>
    
    <tr><td>K. C. Jones</td>
    <td>kj@gmail.com</td></tr>
    
    <tr><td>Satch Sanders</td>
    <td>ss@gmail.com</td></tr>
    
    <tr><td>John Havlicek</td>
    <td>jh@gmail.com</td></tr>
    
    <tr><td>Jim Loscutoff</td>
    <td>jl@gmail.com</td></tr>
    
    <tr><td>Frank Ramsey</td>
    <td>fr@gmail.com</td></tr>
    
    <tr><td>Robert Horry</td>
    <td>rh@gmail.com</td></tr>
</table>

๊ฒฐ๊ณผ)


2.6 ์†์„ฑ ์„ ํƒ์ž (์š”์†Œ[์†์„ฑ=])

ํŠน์ •ํ•œ ์†์„ฑ์„ ๊ฐ€์ง€๋Š” ์š”์†Œ๋ฅผ ์„ ํƒํ•œ๋‹ค. 
ex) title ์†์„ฑ์„ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” h1 ์š”์†Œ๋ฅผ ์„ ํƒํ•œ๋‹ค.

h1[title] {color : red;}

ex) class ์†์„ฑ์ด "example"์ธ p ์š”์†Œ๋ฅผ ์„ ํƒํ•œ๋‹ค. 

p[class="example"] {color : blue;}

 

์˜ˆ์‹œ) 

<head>
<meta charset="UTF-8">
<title>์˜์‚ฌ ํด๋ž˜์Šค</title>
<style type = "text/css">
/* aํƒœ๊ทธ ์ „์ฒด์— ๋ฐฐ๊ฒฝ์ƒ‰ ๋…ธ๋ž€์ƒ‰ */
a{background-color:yellow;}
/* ์†์„ฑ ์„ ํƒ์ž: href ์†์„ฑ์— ๊ฐ’์ด http://www.naver.com/์ธ ๊ฒƒ์„ ์„ ํƒ */
a[href="http://www.naver.com/"]{
color:red;
}
</style>
</head>
<body>
<a href = "http://www.naver.com/">๋„ค์ด๋ฒ„</a>
<a href = "http://www.google.com">๊ตฌ๊ธ€</a>
</body>

๊ฒฐ๊ณผ)

 

2.7 ์„ ํƒ์ž ๊ทธ๋ฃน (h1, h2, h3)

, ์ฝค๋งˆ๋กœ ๋ฌถ์–ด์„œ ํ‘œํ˜„ํ•œ๋‹ค. ๋™์ผํ•œ ๊ทœ์น™์„ ๊ฐ€์ง€๋Š” ์„ ์–ธ์„ ํ•˜๋‚˜๋กœ ์ถ•์•ฝํ•  ์ˆ˜ ์žˆ๋‹ค. 

h1 {font - family: sans-serif;}
h2 {font - family: sans-serif;}
h3 {font - family: sans-serif;}

์œ„์˜ ์„ ์–ธ์€ ์•„๋ž˜์˜ ์„ ์–ธ๊ณผ ๊ฐ™๋‹ค. 

h1, h2, h3 {font - family: sans-serif;}

 

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

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

์˜ˆ์‹œ)

<head>
<meta charset="UTF-8">
<title>์ž์†, ์ž์‹, ํ˜•์ œ ๊ฒฐํ•ฉ์ž p.118 Child</title>
<style type="text/css">
body em{color:red;}
body > h1 {color:blue;} /*์ž์‹ ์š”์†Œ์ธ h1 ์„ ํƒํ•จ*/
</style>
</head>

<body>
<h1> This headline is <em>very</em> important.</h1>
<p> This headline is <em>very</em> important.</p>
</body>

๊ฒฐ๊ณผ)
body ์š”์†Œ์˜ ์ง๊ณ„ ์ž์‹ ์š”์†Œ์ธ h1์˜ ํฐํŠธ ์ƒ‰์ƒ์ด ๋ธ”๋ฃจ ์ƒ‰์ƒ์œผ๋กœ ์ ์šฉ๋˜๊ฒŒ ํ–ˆ์œผ๋ฏ€๋กœ ๊ฒฐ๊ณผ๋ฌผ์ด ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

* DOM = ์ผ์ข…์˜ ์กฑ๋ณด 

 

The Document Object Model (DOM) is an application programming interface (API) for HTML and XML documents. It defines the logical structure of documents and the way a document is accessed and manipulated.

์ถœ์ฒ˜: https://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/introduction.html

DOM representation of the example table

 


3. CSS๋ฅผ ์‚ฝ์ž…ํ•˜๋Š” ๋ฐฉ๋ฒ• p.121

์ด 3๊ฐ€์ง€์˜ ๋ฐฉ๋ฒ•์ด ์žˆ๋‹ค.

 

3.1 ์™ธ๋ถ€ ์Šคํƒ€์ผ ์‹œํŠธ (External style sheet)

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

type ๋’ค์—๋Š” ์™ธ๋ถ€ ํŒŒ์ผ์˜ ์ข…๋ฅ˜๋ฅผ ์•Œ ์ˆ˜ ์žˆ๋‹ค. 

type ="text/css"

rel(relationship)์€ HTML ํŒŒ์ผ๊ณผ ์™ธ๋ถ€ ํŒŒ์ผ๊ณผ์˜ ๊ด€๊ณ„๋ฅผ ๋‚˜ํƒ€๋‚ธ๋‹ค. 

rel="stylesheet"

href์— ์™ธ๋ถ€ํŒŒ์ผ์˜ ์œ„์น˜๋ฅผ ์ ์–ด๋‘”๋‹ค. 

href="css/outter_CSS.css"

์˜ˆ์‹œ) 

<head>
<meta charset="UTF-8">
<title>์™ธ๋ถ€ ์Šคํƒ€์ผ ์‹œํŠธ (External style sheet)</title>
<link type ="text/css" rel="stylesheet" href="css/outter_CSS.css">
</head>

 

3.2 ๋‚ด๋ถ€ ์Šคํƒ€์ผ ์‹œํŠธ (Internal style sheet)

: ๋‚ด๋ถ€ ์Šคํƒ€์ผ ์‹œํŠธ๋Š” HTML ์•ˆ์— CSS๋ฅผ ์ •์˜ํ•˜๋Š” ๊ฒƒ์ด๋‹ค.
<head> ์š”์†Œ ์•ˆ์—๋‹ค ์Šคํƒ€์ผ์„ ์ •์˜ํ•œ <style> </style>์„ ์“ด๋‹ค 
p๋Š” ์„ ํƒ์ž ์ž๋ฆฌ์ด๋‹ค. 

์˜ˆ์‹œ) p์˜ ํฐํŠธ ์‚ฌ์ด์ฆˆ์™€ ์ƒ‰์ƒ์„ ์ •์˜ํ–ˆ๋‹ค. 

<head>
<meta charset="UTF-8">
<title>๋‚ด๋ถ€ ์Šคํƒ€์ผ ์‹œํŠธ (Internal style sheet)</title>
<style type="text/css">
p{font-size:20px;color:red;}
</style>
</head>

 

3.3 ์ธ๋ผ์ธ ์Šคํƒ€์ผ ์‹œํŠธ (Inline style sheet) 

๊ฐ๊ฐ์˜ ์š”์†Œ๋งˆ๋‹ค ์Šคํƒ€์ผ์„ ์ง€์ •ํ•œ๋‹ค. 
๊ฐ ์š”์†Œ์˜ style ์†์„ฑ์„ ์ •์˜ํ•˜์—ฌ ์ฃผ๋ฉด ๋œ๋‹ค.

์˜ˆ์‹œ)

<body> <!-- ๊ฐ๊ฐ ์Šคํƒ€์ผ์„ ์ง€์ •ํ•จ -->
<p style="font-size:20px; color:red;">์•ˆ๋…•ํ•˜์„ธ์š”1</p>
<p style="font-size:20px; color:red; background-color:#00FF00">์•ˆ๋…•ํ•˜์„ธ์š”2</p>
<p style="font-size:20px; color:red; background-color:yellow">์•ˆ๋…•ํ•˜์„ธ์š”3</p>
</body>

๊ฒฐ๊ณผ)


4. ์ƒ‰์ƒ

body{background-color: #ffd800;}

์ƒ‰์ƒ ์ด๋ฆ„, rgb(์ˆซ์ž%, ์ˆซ์ž%, ์ˆซ์ž%), rgb(์ˆซ์ž(0~255), ์ˆซ์ž, ์ˆซ์ž)๋กœ๋„ ๊ฐ€๋Šฅํ•˜๋‹ค. 

 

5. ํฐํŠธ p.135

๋ฐ”๋กœ font๋กœ ์‚ฌ์šฉํ•ด๋„ ๋œ๋‹ค.

h1{background-color:#FFE5CC; 
font: italic 30px 'Rubik Bubbles', cursive;}

 

5.1 ํฐํŠธ ํŒจ๋ฐ€๋ฆฌ: 

ํ…์ŠคํŠธ์˜ ํฐํŠธ ์„ค์ •ํ•œ๋‹ค.

body{font-family:"๊ถ์„œ์ฒด";}

https://fonts.google.com/ ์—์„œ ์›ํ•˜๋Š” ํฐํŠธ ์ด๋ฆ„์„ ๊ฒ€์ƒ‰ ํ›„ Styles์—์„œ (+)๋ฅผ ๋ˆ„๋ฅด๋ฉด HTML, CSS์— ์“ธ ์ˆ˜ ์žˆ๋Š” ์ฝ”๋“œ๊ฐ€ ๋‚˜์˜จ๋‹ค.

 

5.1.1 place the @import at the very top of your CSS, before any rules.
To embed a font, copy the code into the <head> of your html.

<style>
@import url('https://fonts.googleapis.com/css2?family=Rubik+Bubbles&display=swap');
</style>

5.1.2. CSS rules to specify families

font-family: 'Rubik Bubbles', cursive;
.d{background-color:66CC00; font-family:'Rubik Bubbles', cursive;}

 

5.2 ํฐํŠธ ์‚ฌ์ด์ฆˆ

๋‹จ์œ„์˜ ์ ˆ๋Œ“๊ฐ’ 

์ƒ๋Œ€(relative) ๋‹จ์œ„๋ž€ ๊ณ ์ •๋˜์ง€ ์•Š๊ณ  ์–ด๋–ค ๊ธฐ์ค€์— ๋”ฐ๋ผ์„œ ์œ ๋™์ ์œผ๋กœ ๋ฐ”๋€” ์ˆ˜ ์žˆ๋Š” ๊ธธ์ด๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ๋‹จ์œ„์ด๋‹ค. 
em, rem, %, vw, vh๊ฐ€ ์žˆ๋‹ค.

์ ˆ๋Œ€(absolute) ๋‹จ์œ„๋Š” ์–ด๋–ค ์ƒํ™ฉ์—์„œ๋“  ํ•ญ์ƒ ๊ณ ์ •๋œ ๊ธธ์ด๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ๋‹จ์œ„์ด๋‹ค. ๋Œ€ํ‘œ์ ์œผ๋กœ px์™€ pt๊ฐ€ ์žˆ๋‹ค.

/* <absolute-size> values */
font-size: xx-small;
font-size: x-small;
font-size: small;
font-size: medium;
font-size: large;
font-size: x-large;
font-size: xx-large;
font-size: xxx-large;

/* <relative-size> values */
font-size: smaller;
font-size: larger;

/* <length> values */
font-size: 12px;
font-size: 0.8em;

/* <percentage> values */
font-size: 80%;

/* math value */
font-size: math;

/* Global values */
font-size: inherit;
font-size: initial;
font-size: revert;
font-size: revert-layer;
font-size: unset;

Absolute-size keywords, based on the user's default font size (which is medium).

xx-small, x-small, small, medium, large, x-large, xx-large, xxx-large

 

Relative-size keywords. The font will be larger or smaller relative to the parent element's font size, roughly by the ratio used to separate the absolute-size keywords above.

larger, smaller

 

A positive <length> value. For most font-relative units (such as em and ex), the font size is relative to the parent element's font size.

For font-relative units that are root-based (such as rem), the font size is relative to the size of the font used by the <html> (root) element.

<length>
font-size: 12px;
font-size: 0.8em;

 

A positive <percentage> value, relative to the parent element's font size.
Note: To maximize accessibility, it is generally best to use values that are relative to the user's default font size.

<percentage>
font-size: 80%;

 

  • math Experimental Special mathematical scaling rules must be applied when determining the computed value of the font-size property.

์ฐธ๊ณ : https://developer.mozilla.org/en-US/docs/Web/CSS/font-size

 

5.3 ํฐํŠธ ์Šคํƒ€์ผ

font-style: normal;
font-style: italic;

 

5.4 ํฐํŠธ ๊ตต๊ธฐ

font-weight: normal;
font-weight: bold;

6. ํ…์ŠคํŠธ ์Šคํƒ€์ผ ์„ค์ •

6.1 ์ƒ‰์ƒ

color: blue;

 

6.2 ์ •๋ ฌ

text-align: center, right, justify; (์–‘์ชฝ ์ •๋ ฌ)

 

6.3 ์žฅ์‹: ๋ฐ‘์ค„

text-decoration: overline, line-through, underline;

 

6.4 ๋ณ€ํ™˜: ์†Œ๋ฌธ์ž, ๋Œ€๋ฌธ์ž ์ง€์ •

text-transformation:uppercase, lowercase, capitalize(์•ž ๊ธ€์ž๋งŒ ๋Œ€๋ฌธ์ž);

์˜ˆ์‹œ)

<style type = "text/css">
.upper{text-transform:uppercase;}
.lower{text-transform:lowercase;}
.capital{text-transform:capitalize;} 
</style>

<body>
<p class="upper">text_transformation is uppercase.</p>
<p class="lower">text_transformation is lowercase.</p>
<p class="capital">text_transformation is capitalize.</p>
</body>

๊ฒฐ๊ณผ)

 

6.5 Word Wrapping: break-word

์ž๋™์œผ๋กœ ๋‹จ์–ด๋ฅผ ์ž˜๋ผ์„œ ๋‹ค์Œ ์ค„๋กœ ๋„˜๊ธด๋‹ค.

word-wrap: break-word;
.test{width:100px; word-wrap: break-word;}
<p class="test">๋งค์šฐ ๊ธด ๋‹จ์–ด๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ ์ž๋™์œผ๋กœ ์ž˜๋ผ์ค€๋‹ค.</p>

๊ฒฐ๊ณผ) 

6.6 ํ…์ŠคํŠธ ๊ทธ๋ฆผ์ž

text-shadow: 5px 5px 12px orange;

x๋ฐฉํ–ฅ ์ด๋™๊ฑฐ๋ฆฌ(์ˆซ์ž๊ฐ€ ํด์ˆ˜๋ก ์˜ค๋ฅธ์ชฝ์œผ๋กœ ๋–จ์–ด์ง„๋‹ค.),
y ๋ฐฉํ–ฅ ์ด๋™๊ฑฐ๋ฆฌ(์ˆซ์ž๊ฐ€ ํด ์ˆ˜๋ก ์•„๋ž˜๋กœ ๋–จ์–ด์ง„๋‹ค.),
ํ๋ฆผ ์ •๋„,
ํ…์ŠคํŠธ ๊ทธ๋ฆผ์ž ์ƒ‰์ƒ 

์˜ˆ์‹œ) 

<style type="text/css">
@import url('http://fonts.googleapis.com/css2?family=Ribik+Bibbles&display=swap');

h1{background-color:#FFE5CC; 
color: red;
text-shadow: 5px 5px 12px orange;
font: italic 30px 'Rubik Bubbles', cursive;}
</style>

๊ฒฐ๊ณผ)

 

6.7 border

์„  (or ์ ์„ ), ํฌ๊ธฐ, ์ƒ‰์ƒ (์ˆœ์„œ๋Š” ์ƒ๊ด€์—†๋‹ค.)

border:solid (or dotted) 5px black
border-top: dotted 3px red;
border-bottom: solid 5px green;
border-left: solid 2px black;

๊ฒฐ๊ณผ)


728x90
๋ฐ˜์‘ํ˜•

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

[7] 230105 Ch. 6 CSS ๋ ˆ์ด์•„์›ƒ๊ณผ ์• ๋‹ˆ๋ฉ”์ด์…˜: ๋ ˆ์ด์•„์›ƒ์˜ ๊ธฐ์ดˆ, ์š”์†Œ ์œ„์น˜ ์ •ํ•˜๊ธฐ, <div> ์š”์†Œ ยท ์˜๋ฏธ์  ์š”์†Œ๋ฅผ ์ด์šฉํ•œ ๋ ˆ์ด์•„์›ƒ, ํšจ๊ณผ, CSS3 ๋ณ€ํ™˜ ยท 3์ฐจ์› ๋ณ€ํ™˜ ยท ์• ๋‹ˆ๋ฉ”์ด์…˜ [K-๋””์ง€ํ„ธ ํŠธ๋ ˆ์ด๋‹ 7์ผ]  (0) 2023.01.05
[6] 230104 Ch. 5 CSS3 ๋ฐ•์Šค ๋ชจ๋ธ๊ณผ ์‘์šฉ: ๋ฐ•์Šค ๋ชจ๋ธ, ๊ฒฝ๊ณ„์„ , ๋งˆ์ง„๊ณผ ํŒจ๋”ฉ, ๋ฐฐ๊ฒฝ ์„ค์ •ํ•˜๊ธฐ, ๋งํฌ ยท ๋ฆฌ์ŠคํŠธ ยท ํ…Œ์ด๋ธ” ์Šคํƒ€์ผ [K-๋””์ง€ํ„ธ ํŠธ๋ ˆ์ด๋‹ 6์ผ]  (0) 2023.01.04
[4] 230102 Ch. 3 HTML5 ๋ฉ€ํ‹ฐ๋ฏธ๋””์–ด & ์ž…๋ ฅ์–‘์‹: ์›น ๋ธŒ๋ผ์šฐ์ €์™€ ๋ฉ€ํ‹ฐ๋ฏธ๋””์–ด, ์˜ค๋””์˜ค, ๋น„๋””์˜ค, iframe, <div>์™€ <span>, HTML ์ž…๋ ฅ ์–‘์‹, ์ž…๋ ฅ ํƒœ๊ทธ #1 ยท #2, HTML5 ์ž…๋ ฅ ์š”์†Œ [K-๋””์ง€ํ„ธ ํŠธ๋ ˆ์ด๋‹ 4์ผ]  (3) 2023.01.02
[3] 221230 Ch. 2 HTML5 ๊ธฐ๋ณธ ์š”์†Œ: ํ…์ŠคํŠธ ํ‘œ์‹œ, ๋ฆฌ์ŠคํŠธ, ๋งํฌ, ์ด๋ฏธ์ง€, ํ…Œ์ด๋ธ” [K-๋””์ง€ํ„ธ ํŠธ๋ ˆ์ด๋‹ 3์ผ]  (1) 2022.12.30
Comments