Search

๊ธ€๊ผด ์†์„ฑ

๊ธ€๊ผด ์†์„ฑ (Font Properties)

ํ…์ŠคํŠธ์˜ ๊ธฐ๋ณธ ์Šคํƒ€์ผ์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.
โ€ข
์ž์ฃผ ์‚ฌ์šฉํ•˜๋Š” ์†์„ฑ
โ€ข
๊ธ€๊ผด ์†์„ฑ ์ข…๋ฅ˜
โ€ข
๊ธฐ๋ณธ ์˜ˆ์‹œ ์ฝ”๋“œ
โ€ข
ํฐํŠธ ์ง€์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•
โ—ฆ
์™ธ๋ถ€ ํฐํŠธ
โ—ฆ
ํŒŒ์ผ ํฐํŠธ
โ—ฆ
๋ฉ”์ธ ํฐํŠธ & ๊ฐ•์กฐ ํฐํŠธ

์ž์ฃผ ์‚ฌ์šฉํ•˜๋Š” ์†์„ฑ

์†์„ฑ
์„ค๋ช…
์˜ˆ์‹œ
font-size
๊ธ€๊ผด์˜ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. -์ ˆ๋Œ€๊ฐ’(๋‹จ์œ„: px, pt ๋“ฑ) -์ƒ๋Œ€๊ฐ’(em, rem, %, vw ๋“ฑ)
font-size: 16px;, font-size: 1.5rem;
text-align
ํ…์ŠคํŠธ์˜ ์ˆ˜ํ‰ ์ •๋ ฌ์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. left, right, center, justify ๋“ฑ ์‚ฌ์šฉ
text-align: center;, text-align: justify;
font-family
๊ธ€๊ผด์„ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๋Ÿฌ ๊ธ€๊ผด์„ ์‰ผํ‘œ๋กœ ๊ตฌ๋ถ„ํ•ด ์ž‘์„ฑํ•˜๋ฉฐ, ์‹œ์Šคํ…œ ๊ธฐ๋ณธ ๊ธ€๊ผด๋„ ์„ค์ • ๊ฐ€๋Šฅ.
font-family: Arial, sans-serif;

๊ธ€๊ผด ์†์„ฑ ์ข…๋ฅ˜

์†์„ฑ
์„ค๋ช…
font-family
๊ธ€๊ผด ์ด๋ฆ„์„ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๋Ÿฌ ๊ธ€๊ผด์„ ์‰ผํ‘œ๋กœ ๊ตฌ๋ถ„ํ•˜์—ฌ ์ง€์ •ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์‹œ์Šคํ…œ ๊ธฐ๋ณธ ๊ธ€๊ผด๋„ ์„ค์ • ๊ฐ€๋Šฅ.
font-size
๊ธ€๊ผด์˜ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. ์ ˆ๋Œ€ ํฌ๊ธฐ(px), ์ƒ๋Œ€ ํฌ๊ธฐ(em, rem), ๋ฐฑ๋ถ„์œจ(%) ๋“ฑ์œผ๋กœ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
font-weight
๊ธ€๊ผด์˜ ๊ตต๊ธฐ๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. ๊ฐ’์œผ๋กœ normal, bold, ๋˜๋Š” 100๋ถ€ํ„ฐ 900๊นŒ์ง€์˜ ์ˆซ์ž๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
font-style
๊ธ€๊ผด์˜ ์Šคํƒ€์ผ์„ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. normal, italic, oblique ๊ฐ’์ด ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.
font-variant
์ž‘์€ ๋Œ€๋ฌธ์ž๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ๋“ฑ ํŠน์ˆ˜ํ•œ ๊ธ€๊ผด ๋ณ€ํ˜•์„ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. normal, small-caps ๊ฐ’์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
line-height
์ค„ ๊ฐ„๊ฒฉ์„ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. ์ˆซ์ž, ๋ฐฑ๋ถ„์œจ, ๋‹จ์œ„(px, em) ๋“ฑ์„ ์‚ฌ์šฉํ•˜์—ฌ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
letter-spacing
๊ธ€์ž ๊ฐ„๊ฒฉ์„ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. ์Œ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ธ€์ž๋ฅผ ์ขํžˆ๊ฑฐ๋‚˜ ์–‘์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋„“ํž ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
word-spacing
๋‹จ์–ด ๊ฐ„ ๊ฐ„๊ฒฉ์„ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. ์Œ์ˆ˜์™€ ์–‘์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์กฐ์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
text-transform
๊ธ€์ž์˜ ๋Œ€์†Œ๋ฌธ์ž๋ฅผ ๋ณ€ํ™˜ํ•ฉ๋‹ˆ๋‹ค. none, capitalize, uppercase, lowercase ๊ฐ’์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
text-align
ํ…์ŠคํŠธ์˜ ์ •๋ ฌ์„ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. left, right, center, justify ๊ฐ’์ด ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.

๊ธฐ๋ณธ ์˜ˆ์‹œ ์ฝ”๋“œ

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>ํ…์ŠคํŠธ ์Šคํƒ€์ผ</title> <style> /* ๊ธฐ๋ณธ ํ…์ŠคํŠธ ์Šคํƒ€์ผ */ body { /* ๊ธ€๊ผด ์ง€์ • */ font-family: Arial, Helvetica, sans-serif; /* ๊ธ€๊ผด ํฌ๊ธฐ */ font-size: 16px; /* ์ค„ ๊ฐ„๊ฒฉ */ line-height: 1.8; /* px๋‹จ์œ„, ๊ทธ๋ƒฅ์ˆซ์ž(๋ฐฐ์œจ) */ /* ์ƒ‰์ƒ */ color: #ff22ee; } h1 { font-size: 32px; /* ๊ธ€๊ผด ๊ตต๊ธฐ */ font-weight: lighter; /* (์–‡์€)100~900(๊ตต์€) */ /* lighter, normal, bold, bolder */ } p.bold { font-weight: bold; color: #22ffcc; } p.highlight { /* ๊ธ€๊ผด ์Šคํƒ€์ผ */ font-style: italic; /* normal, oblique, italic */ color: red; } a { /* ๊ธ€๊ผด ์žฅ์‹ */ text-decoration: none; /* none(์—†์Œ), underline(๋ฐ‘์ค„) overline(์œ—์ค„), line-through(์ทจ์†Œ์„ ) */ color: white; background-color: black; padding: 12px 24px; border-radius: 5px; } /* :hover ๊ฐ€์ƒ ์„ ํƒ์ž - ๋งˆ์šฐ์Šค ์˜ฌ๋ ธ์„ ๋•Œ ์ƒํƒœ ์„ ํƒ */ a:hover { box-shadow: 5px 5px 5px rgba(0,0,0,0.2); background-color: #222222; } </style> </head> <body> <h1>ํ…์ŠคํŠธ ์Šคํƒ€์ผ ์ง€์ •ํ•˜๊ธฐ</h1> <p>ํ…์ŠคํŠธ ์Šคํƒ€์ผ์„ ์ง€์ •ํ•˜๋Š” ๋ฌธ์žฅ์ž…๋‹ˆ๋‹ค.</p> <p class="bold">๊ฐ•์กฐํ•˜๋Š” ๋ฌธ์žฅ์ž…๋‹ˆ๋‹ค.</p> <p class="highlight">์ค‘์š”ํ•œ ๋ฌธ์žฅ์ž…๋‹ˆ๋‹ค.</p> <a href="https://์•Œํด.com">Button</a> </body> </html>
HTML
๋ณต์‚ฌ

ํฐํŠธ ์ง€์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•

โ€ข
์™ธ๋ถ€ ํฐํŠธ
โ€ข
ํŒŒ์ผ ํฐํŠธ
โ€ข
๋ฉ”์ธ ํฐํŠธ & ๊ฐ•์กฐ ํฐํŠธ

์™ธ๋ถ€ ํฐํŠธ

PC ๋‚ด์˜ ํŒŒ์ผ ํฐํŠธ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹Œ CDN ๋ฐฉ์‹์œผ๋กœ ํฐํŠธ ํŒŒ์ผ์„ ๊ฐ€์ ธ์™€ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ์‹
2.
<head> ํƒœ๊ทธ ์•ˆ์— CDN <link> ํƒœ๊ทธ ํฌํ•จํ•˜๊ธฐ
3.
<style> ์—์„œ * ๋˜๋Š” body ๋ฅผ ์„ ํƒํ•˜์—ฌ ์ „์ฒด ๊ธ€๊ผด๋กœ ์ง€์ •ํ•˜๊ธฐ
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>์™ธ๋ถ€ ํฌํŠผ ์‚ฌ์šฉํ•˜๊ธฐ</title> <!-- ํฐํŠธ ํฌํ•จํ•˜๊ธฐ --> <!-- CDN ๋ฐฉ์‹ ํฐํŠธ ์‚ฌ์šฉํ•˜๊ธฐ --> <link href="https://fonts.googleapis.com/css2?family=Gamja+Flower&display=swap" rel="stylesheet"> <style> body { font-family: "Gamja Flower", sans-serif; font-weight: 400; font-style: normal; } </style> </head> <body> <h1>์™ธ๋ถ€ ํฐํŠธ ์‚ฌ์šฉํ•˜๊ธฐ</h1> <h2>๊ตฌ๊ธ€ ํฐํŠธ</h2> <ol> <li>๊ตฌ๊ธ€ ํฐํŠธ ์‚ฌ์ดํŠธ ์ ‘์†</li> <li>ํฐํŠธ ์„ ํƒ</li> <li>link ํƒœ๊ทธ ์ž‘์„ฑ</li> <li>font-family ์†์„ฑ ์ ์šฉ</li> </ol> </body> </html>
HTML
๋ณต์‚ฌ

ํŒŒ์ผ ํฐํŠธ

.ttf, .otf .woff ํ˜•์‹์˜ ํฐํŠธ ํŒŒ์ผ์„ ํ”„๋กœ์ ํŠธ ๋‚ด์— ํฌํ•จํ•˜๊ณ  CSS ์—์„œ ๋ถˆ๋Ÿฌ์˜ค๋Š” ๋ฐฉ์‹
1.
ํ”„๋กœ์ ํŠธ ๋‚ด์— ํฐํŠธ ํŒŒ์ผ ์ค€๋น„
a.
fonts / font-name.ttf
2.
@font-face ์‚ฌ์šฉ์ž ์ •์˜ ๊ธ€๊ผด ์„ ์–ธ
@font-face { font-family: "Gamja Flower"; src: url('fonts/GamjaFlower-Regular.ttf'); }
CSS
๋ณต์‚ฌ
fonts/GamjaFlower-Regular.ttf ํฐํŠธ ํŒŒ์ผ์„ ๋ถˆ๋Ÿฌ์™€, Gamja Flower ์ด๋ผ๋Š” ๊ธ€๊ผด ์ด๋ฆ„์œผ๋กœ ์„ ์–ธ
3.
์„ ์–ธํ•œ ๊ธ€๊ผด ์Šคํƒ€์ผ ์†์„ฑ์œผ๋กœ ์ง€์ •
body { font-family: "Gamja Flower", sans-serif; }
CSS
๋ณต์‚ฌ
@ (at-rule) [์•ณ ๊ทœ์น™] ์ด๋ž€?
: CSS ์—์„œ ํŠน๋ณ„ํ•œ ๊ทœ์น™์ด๋‚˜ ์กฐ๊ฑด์„ ์„ ์–ธํ•˜๋Š” ๋ฌธ๋ฒ•์ž…๋‹ˆ๋‹ค.
์ผ๋ฐ˜์ ์œผ๋กœ ์•„๋ž˜์˜ ๋‚ด์šฉ๋“ค์„ ์ •์˜ํ•˜๊ธฐ ์œ„ํ•ด์„œ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
์‚ฌ์šฉ์ž ์ •์˜ ํฐํŠธ ์„ค์ • @font-face
์• ๋‹ˆ๋ฉ”์ด์…˜ ํ‚คํ”„๋ ˆ์ž„ ์ •์˜ @keyframes
๋ฐ˜์‘ํ˜• ์Šคํƒ€์ผ ์ ์šฉ @media
At-rule
์„ค๋ช…
์˜ˆ์‹œ
@import
์™ธ๋ถ€ CSS ํŒŒ์ผ์„ ํ˜„์žฌ ์Šคํƒ€์ผ ์‹œํŠธ์— ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.
@import url('style.css');
@media
ํŠน์ • ๋ฏธ๋””์–ด ์กฐ๊ฑด(ํ™”๋ฉด ํฌ๊ธฐ, ํ•ด์ƒ๋„ ๋“ฑ)์— ๋”ฐ๋ผ ๋‹ค๋ฅธ ์Šคํƒ€์ผ์„ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค.
@media (max-width: 600px) { body { color: blue; } }
@font-face
์‚ฌ์šฉ์ž ์ •์˜ ๊ธ€๊ผด์„ ๋ถˆ๋Ÿฌ์™€์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ์„ ์–ธํ•ฉ๋‹ˆ๋‹ค.
@font-face { font-family: 'MyFont'; src: url('myfont.woff2'); }
@keyframes
CSS ์• ๋‹ˆ๋ฉ”์ด์…˜์˜ ํ‚คํ”„๋ ˆ์ž„์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค.
@keyframes slidein { from { left: 0; } to { left: 100%; } }
@supports
ํŠน์ • CSS ๊ธฐ๋Šฅ์„ ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ์ง€์›ํ•˜๋Š”์ง€ ํ™•์ธํ•˜์—ฌ ์กฐ๊ฑด๋ถ€๋กœ ์Šคํƒ€์ผ์„ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค.
@supports (display: grid) { div { display: grid; } }
@namespace
XML ๋ฌธ์„œ์—์„œ ๋„ค์ž„์ŠคํŽ˜์ด์Šค๋ฅผ ์„ ์–ธํ•  ๋•Œ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.
@namespace svg url(http://www.w3.org/2000/svg);
@charset
CSS ํŒŒ์ผ์˜ ๋ฌธ์ž ์ธ์ฝ”๋”ฉ ๋ฐฉ์‹์„ ์„ ์–ธํ•ฉ๋‹ˆ๋‹ค. ํŒŒ์ผ์˜ ๊ฐ€์žฅ ์ฒซ ์ค„์— ์œ„์น˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
@charset "UTF-8";
@page
์ธ์‡„ ๋ฏธ๋””์–ด์—์„œ ํŽ˜์ด์ง€ ๋ ˆ์ด์•„์›ƒ์„ ์„ค์ •ํ•  ๋•Œ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.
@page { margin: 1cm; }
@counter-style
์‚ฌ์šฉ์ž ์ •์˜ ๋ฆฌ์ŠคํŠธ ํ•ญ๋ชฉ ์Šคํƒ€์ผ์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค.
@counter-style mylist { system: numeric; }
@document
ํŠน์ • URL์ด๋‚˜ ๋„๋ฉ”์ธ์—์„œ๋งŒ ์Šคํƒ€์ผ์„ ์ ์šฉํ•  ๋•Œ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. (์ด ๊ทœ์น™์€ ๋น„ํ‘œ์ค€์ž…๋‹ˆ๋‹ค.)
@document url("https://example.com") { ... }
@viewport
๋ทฐํฌํŠธ์˜ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. ์ฃผ๋กœ ๋ชจ๋ฐ”์ผ ๊ธฐ๊ธฐ์—์„œ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. (์ด ๊ทœ์น™์€ ๋น„ํ‘œ์ค€์ž…๋‹ˆ๋‹ค.)
@viewport { width: device-width; }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> @font-face { font-family: "Gamja Flower"; src: url('fonts/GamjaFlower-Regular.ttf'); } body { font-family: "Gamja Flower", sans-serif; } </style> </head> <body> <h1>ํฐํŠธ ํŒŒ์ผ๋กœ ๊ธ€๊ผด ์ ์šฉํ•˜๊ธฐ</h1> <h3>ttf, otf, woff ๋“ฑ ํฐํŠธํŒŒ์ผ ๋‹ค์šด๋กœ๋“œ ๋ฐ ์ค€๋น„</h3> <ol> <li>ํฐํŠธ ํŒŒ์ผ ๋‹ค์šด๋กœ๋“œ</li> <li>@font-face ์— src ์†์„ฑ ์ง€์ •</li> <li>url() ํ•จ์ˆ˜๋กœ ํฐํŠธํŒŒ์ผ ๊ฒฝ๋กœ ์ง€์ •</li> <li>font-family ์†์„ฑ์œผ๋กœ ์Šคํƒ€์ผ ์ง€์ •</li> </ol> </body> </html>
HTML
๋ณต์‚ฌ

๋ฉ”์ธ ํฐํŠธ & ๊ฐ•์กฐ ํฐํŠธ

:root ์„ ํƒ์ž๋กœ ๋ฉ”์ธ ํฐํŠธ์™€ ๊ฐ•์กฐ ํฐํŠธ๋ฅผ ๋ณ€์ˆ˜๋กœ ์„ ์–ธํ•˜์—ฌ, ์‚ฌ์šฉํ•ด๋ด…๋‹ˆ๋‹ค.
โ€ข
:root ์„ ํƒ์ž
โ€ข
CSS ๋ณ€์ˆ˜ ์„ ์–ธ
โ€ข
CSS ๋ณ€์ˆ˜ ์‚ฌ์šฉ
โ€ข
๋ฉ”์ธ ํฐํŠธ & ๊ฐ•์กฐ ํฐํŠธ ์‚ฌ์šฉ ์˜ˆ์‹œ ์ฝ”๋“œ

:root ์„ ํƒ์ž

html ์š”์†Œ๋ฅผ ์ง€์ •ํ•˜๋Š” ์„ ํƒ์ž๋กœ, html ํƒœ๊ทธ ์„ ํƒ์ž๋ณด๋‹ค ๋” ๋†’์€ ์šฐ์„  ์ˆœ์œ„๋ฅผ ๊ฐ–๋Š” ์„ ํƒ์ž
CSS ๋ณ€์ˆ˜ ์ •์˜
์ „์—ญ ์Šคํƒ€์ผ ์„ค์ •
CSS ์Šคํƒ€์ผ ์ „์ฒด์—์„œ ์‚ฌ์šฉํ•  ๋ณ€์ˆ˜๋ฅผ ์„ ์–ธํ•˜๊ฑฐ๋‚˜ ์ „์—ญ ์Šคํƒ€์ผ์„ ์ ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

CSS ๋ณ€์ˆ˜ ์„ ์–ธ

-- ๊ธฐํ˜ธ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ CSS ๋ณ€์ˆ˜๋ฅผ ์„ ์–ธํ•ฉ๋‹ˆ๋‹ค.
--๋ณ€์ˆ˜๋ช… : ์†์„ฑ๊ฐ’;
CSS
๋ณต์‚ฌ
:root { --main-color: #3498db; --main-font: 'Arial', sans-serif; }
CSS
๋ณต์‚ฌ

CSS ๋ณ€์ˆ˜ ์‚ฌ์šฉ

var() ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ณ€์ˆ˜์˜ ๊ฐ’์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
์Šคํƒ€์ผ์†์„ฑ : var(๋ณ€์ˆ˜๋ช…);
CSS
๋ณต์‚ฌ
h1 { color : var(--main-color); }
CSS
๋ณต์‚ฌ

๋ฉ”์ธ ํฐํŠธ & ๊ฐ•์กฐ ํฐํŠธ ์‚ฌ์šฉ ์˜ˆ์‹œ ์ฝ”๋“œ

1.
๋ณ€์ˆ˜ ์„ ์–ธ
2.
๋ฉ”์ธ ํฐํŠธ ์ „์—ญ ํฐํŠธ ์ง€์ •
3.
๊ฐ•์กฐ ํฐํŠธ ํŠน์ • ์š”์†Œ ์ง€์ •

๋ณ€์ˆ˜ ์„ ์–ธ

:root { --main-font: 'Arial', sans-serif; /* ๋ฉ”์ธ ํฐํŠธ */ --highlight-font: 'Georgia', serif; /* ๊ฐ•์กฐ ํฐํŠธ */ }
CSS
๋ณต์‚ฌ

๋ฉ”์ธ ํฐํŠธ ์ „์—ญ ํฐํŠธ ์ง€์ •

html { font-family: var(--main-font); /* ์ „์ฒด์— ๋ฉ”์ธ ํฐํŠธ ์ ์šฉ */ }
CSS
๋ณต์‚ฌ

๊ฐ•์กฐ ํฐํŠธ ํŠน์ • ์š”์†Œ ์ง€์ •

h1, h2, .highlight { font-family: var(--highlight-font); /* ํŠน์ • ์š”์†Œ์— ๊ฐ•์กฐ ํฐํŠธ ์ ์šฉ */ }
CSS
๋ณต์‚ฌ
โ€ข
HTML
<!DOCTYPE html> <html lang="ko"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="style.css"> <title>ํฐํŠธ ์˜ˆ์‹œ</title> </head> <body> <h1>๊ฐ•์กฐ ํฐํŠธ๊ฐ€ ์ ์šฉ๋œ ์ œ๋ชฉ์ž…๋‹ˆ๋‹ค</h1> <p>์ด ๋ฌธ๋‹จ์€ ๊ธฐ๋ณธ ํฐํŠธ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.</p> <p class="highlight">์ด ํ…์ŠคํŠธ๋Š” ๊ฐ•์กฐ ํฐํŠธ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.</p> </body> </html>
HTML
๋ณต์‚ฌ
โ€ข
CSS
:root { --main-font: 'Roboto', sans-serif; --highlight-font: 'Georgia', serif; } html { font-family: var(--main-font); /* ์ „์ฒด์— ๋ฉ”์ธ ํฐํŠธ ์ ์šฉ */ } h1, h2, .highlight { font-family: var(--highlight-font); /* ํ—ค๋”ฉ์ด๋‚˜ ํŠน์ • ๊ฐ•์กฐ ์š”์†Œ์— ๊ฐ•์กฐ ํฐํŠธ ์ ์šฉ */ }
CSS
๋ณต์‚ฌ
์Šคํƒ€์ผ ์†์„ฑ
์Šคํƒ€์ผ ์†์„ฑ