Front-end/CSS

[CSS3] Typography

์œค๋ฏผ_ 2022. 3. 28. 20:15

๐Ÿ–‹CSS์‚ฌ์šฉ ์‹œ Typo์— ํ•ด๋‹น๋˜๋Š” ์†์„ฑ์„ ์•Œ์•„๋ณด๊ฒ ๋‹ค.

๋””์ž์ด๋„ˆ๋“ค์ด ์„ค์ •ํ•œ ๋ถ€๋ถ„์„ setting ํ•  ๋•Œ, ์‚ฌ์šฉ๋˜๋Š” ์†์„ฑ๋“ค์„ ๋‹ค๋ค„๋ณธ๋‹ค.

1. font size

ํฐํŠธ์˜ ์‚ฌ์ด์ฆˆ๋ฅผ ์กฐ์ ˆํ•œ๋‹ค.

.text{
  font-size: 16px;
  }

ํฐํŠธ ์‚ฌ์ด์ฆˆ๋ฅผ ์กฐ์ ˆํ•  ๋•Œ ์‚ฌ์šฉ ๊ฐ€๋Šฅ ๋‹จ์œ„๋Š” 3๊ฐ€์ง€ px, em, rem์ด๋‹ค.

(font size๋ฅผ ์กฐ์ ˆํ•  ๋•Œ๋Š” ์ฃผ๋กœ px์ด ๋งŽ์ด ์‚ฌ์šฉ๋œ๋‹ค.)


๐Ÿ“ px 

โœ”์ ˆ๋Œ€ ๋‹จ์œ„

 

๐Ÿ“ em (equal to capital M: ๋Œ€๋ฌธ์ž M์‚ฌ์ด์ฆˆ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ํ•œ๋‹ค.)

โœ”์ƒ๋Œ€ ๋‹จ์œ„(๊ธฐ์ค€์— ๋”ฐ๋ผ ๋‹ฌ๋ผ์ง€๋Š” ๋‹จ์œ„)

โœ”์‹ค์ œ๋กœ ์ ์šฉ๋œ ํฐํŠธ ์‚ฌ์ด์ฆˆ์ด๋‹ค. 

.text{
  font-size: 16px;
  }
  
p{
  font-size: 1em;
  }

์ƒ๋‹จ์˜ ์ฝ”๋“œ๊ฐ€ ์‹ค์ œ๋กœ ์ ์šฉ๋œ ํฐํŠธ ์‚ฌ์ด์ฆˆ(๋ถ€๋ชจ ์š”์†Œ)๊ฐ€

16px์ด๋‹ˆ 1em์€ 16px๋กœ ์„ค์ •์ด๋˜๋Š” ๊ฒƒ์ด๋‹ค.

(1em = 16px)

 

๐Ÿ“ rem(root em: root๋ฟŒ๋ฆฌ ์ฆ‰, ๊ฐ€์žฅ ๋†’์€ ๋ถ€๋ชจ ์š”์†Œ HTML)

โœ”์ƒ๋Œ€ ๋‹จ์œ„

โœ”root๋ฟŒ๋ฆฌ ์ฆ‰,HTML์˜ ๊ฐ€์žฅ ํฐ ๋ถ€๋ชจ ์š”์†Œ์ธ html์— ์ ์šฉ๋œ ํฐํŠธ ์‚ฌ์ด์ฆˆ์ด๋‹ค.

html{
  font-size: 16px;
  }
  
.text{
  font-size: 16px;
  }
  
p{
  font-size: 3em;
  }

์ƒ๋‹จ์˜ ์ฝ”๋“œ๊ฐ€ html์— ์ ์šฉ๋œ ํฐํŠธ ์‚ฌ์ด์ฆˆ(๋ถ€๋ชจ ์š”์†Œ)๊ฐ€

16px์ด๋‹ˆ 1em์€ 16px๋กœ ์„ค์ •์ด๋˜๋Š” ๊ฒƒ์ด๋‹ค.

(3em = 48px)


2. line height

์ด ์†์„ฑ์€ ์ค„์˜ ๋†’์ด ์ฆ‰, ์ค„ ๊ฐ„๊ฒฉ์„ ์˜๋ฏธํ•œ๋‹ค.

.text{
  font-size: 16px;
  line-height:1.5;
  }

๋‹จ์œ„๋Š” ๋™์ผํ•˜๊ฒŒ px, em, rem์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

line height๋ฅผ ์‚ฌ์šฉํ• ๋•Œ๋Š” ์ฃผ๋กœ em์„ ๋งŽ์ด ์‚ฌ์šฉํ•œ๋‹ค.

 

line height๋ฅผ ์‚ฌ์šฉํ• ๋•Œ๋Š” ํฌ๊ธฐ์— ์ƒ๊ด€์—†์ด ๋ฌด์กฐ๊ฑด line height์˜ ์ค‘๋‹จ์— ๊ธ€์”จ๊ฐ€ ๋ฐฐ์น˜๋œ๋‹ค.

 

3. letter spacing

๊ธ€์ž์™€ ๊ธ€์ž ์‚ฌ์ด์˜ ์ž๊ฐ„

.text{
  font-size: 16px;
  line-height:1.5;
  letter-spacing:-0.3em;
  }

๋‹จ์œ„๋Š” px, em์ด๋‹ค.(rem์€ ์ž˜ ์‚ฌ์šฉ ์•ˆ ํ•จ)

letter spacing์„ ์‚ฌ์šฉํ•  ๋•Œ๋Š” ์ฃผ๋กœ em์„ ๋งŽ์ด ์‚ฌ์šฉํ•œ๋‹ค.

 

4. font family

font ์„œ์ฒด๋ฅผ ์‚ฌ์šฉํ•  ๋•Œ ์‚ฌ์šฉ๋˜๋Š” ์†์„ฑ์ด๋‹ค.

.text{
  font-size: 16px;
  line-height:1.5;
  letter-spacing:-0.3em;
  font-family:"Poppins",sans-serif;
  }
.text {	
  font-family: "Poppins";/*Poppins ์ ์šฉ*/
  font-family: "Poppins", sans-serif;/*Poppins ์ ์šฉ, ์—†๋‹ค๋ฉด sans-serif๊ณ„์—ด ์ ์šฉ*/
  font-family: "Poppins", "Roboto", sans-serif;/*Poppins ์ ์šฉ,Roboto์ ์šฉ, ์—†๋‹ค๋ฉด sans-serif๊ณ„์—ด ์ ์šฉ*/
}

5. font weight

font์˜ ๊ตต๊ธฐ๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ์†์„ฑ์ด๋‹ค.

.text{
  font-size: 16px;
  line-height:1.5;
  letter-spacing:-0.3em;
  font-family:"Poppins",sans-serif;
  font-weight: 400;
  /*100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 */
  }

์‚ฌ์šฉ ๋‹จ์œ„๋Š” 100์”ฉ ๋Š์–ด์ง„๋‹ค.

{400(regular),700(bold)์ด ๋งŽ์ด ์‚ฌ์šฉ๋œ๋‹ค}

6. color

์›ํ•˜๋Š” ๊ธ€์”จ ์ƒ‰์ƒ ์„ค์ •

.text{
  font-size: 16px;
  line-height:1.5;
  letter-spacing:-0.3em;
  font-family:"Poppins",sans-serif;
  font-weight: 400;
  color: #ffff;
  /* hex | rgb | rgba*/
  }

์‚ฌ์šฉ๋˜๋Š” ๋‹จ์œ„๋Š” hex, rgb, rgba 3๊ฐ€์ง€๊ฐ€ ์žˆ๋‹ค.

hex: #fff

rgb: ๋น›์˜ 3 ์›์ƒ‰

rgba: ๋น›์˜ 3 ์›์ƒ‰์— ์•ŒํŒŒ ์ถ”๊ฐ€(์•ŒํŒŒ๋Š” ๋น›์˜ ํˆฌ๋ช…๋„๋ฅผ ์˜๋ฏธ)

 

 


7. text align

text์˜ ์ •๋ ฌ์„ ๋‚˜ํƒ€๋‚ด๋Š” ์†์„ฑ์ด๋‹ค.

.text {
  text-align: center;
  /* left | center | right*/
}

8. text indent

text๋ฅผ ๋“ค์—ฌ์“ฐ๊ธฐ ํ•  ๋•Œ ์‚ฌ์šฉ๋˜๋Š” ์†์„ฑ์ด๋‹ค.

.text {
  text-align: center;
  text-indent:100;
}

9. text transform

text๋ฅผ ๋ณ€ํ˜•ํ•œ๋‹ค.(์•Œ๋ฐ”ํŽซ ๋ฒ ์ด์Šค ๋œ ๋ฌธ์ž๋“ค์— ์ ์šฉ.)

.text {
  text-align: center;
  text-indent: 100;
  text-transform: none;
  /* none | capitalize | uppercase | lowercase  */
}

10. text decoration

text ์ค„์„ ๋Š๋Š” ๊ฒƒ๊ณผ ๊ด€๋ จ๋œ ์†์„ฑ์ด๋‹ค.

.text {
  text-align: center;
  text-indent: 100;
  text-transform: none;
  text-decoration: none;
  /* none | underline | line-through | overline  */
}

11. font-style

font์— style์„ ์ ์šฉํ•˜๋Š” ๊ฒƒ(์ฃผ๋กœ italic์„ ์‚ฌ์šฉํ•œ๋‹ค.)

.text {
  text-align: center;
  text-indent: 100;
  text-transform: none;
  text-decoration: none;
  font-style: italic;
  /* normal | italic | oblique */
}

 

 

'Front-end > CSS' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[CSS3]Transition & Animation  (0) 2022.04.03
[CSS3]Media Query(๋ฐ˜์‘ํ˜• ์›น)  (0) 2022.03.27
[CSS3]Flexbox  (0) 2022.03.26
[CSS3]Position  (0) 2022.03.20
[CSS3]Float๋ž€? / Layout ์˜ค๋ฅ˜ ์‹œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•  (0) 2022.03.14