FE/HTML,CSS

[css] ๋‹จ์œ„ | background | font

mandelina 2022. 4. 7. 15:04

CSS

 

๐Ÿš€ ๋‹จ์œ„

๋‹จ์œ„๋Š” ์ ˆ๋Œ€๊ธธ์ด์™€ ์ƒ๋Œ€๊ธธ์ด ๋‹จ์œ„๋กœ ๋‚˜๋‰œ๋‹ค.

 

1. ์ ˆ๋Œ€๊ธธ์ด๋‹จ์œ„ 

- px

picture + Element ์˜ ์•ฝ์ž , ํ™”์†Œ๋ฅผ ์˜๋ฏธํ•œ๋‹ค.

์ ˆ๋Œ€ ๊ธธ์ด ๋‹จ์œ„๋กœ css์—์„œ ๊ฐ€์žฅ ๋งŽ์ด ์“ฐ์ด๋Š” ๊ธฐ๋ณธ๋‹จ์œ„์ด๋‹ค.

(์ดˆ๊ธฐ ๊ธฐ๋ณธ px ํฌ๊ธฐ๋Š” 16px) 

 

2.์ƒ๋Œ€๊ธธ์ด๋‹จ์œ„

 

- em

๋ฐฐ์ˆ˜์˜ ๋‹จ์œ„ . ๋ถ€๋ชจ ์š”์†Œ์˜ ๊ธ€์žํฌ๊ธฐ ๊ธฐ์ค€์œผ๋กœ ๋ฐฐํ•œ๋‹ค.

 

ex) ๋ถ€๋ชจ์š”์†Œ font-size : 16px  โžœ 1em : 16px , 2em : 32px  . . . 

 

 

- rem

root + em์ด๋ผ ์ƒ๊ฐํ•˜๋ฉด ๋œ๋‹ค.

์ตœ์ƒ์œ„์š”์†Œ (html)์˜ ๊ธ€์ž ํฌ๊ธฐ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ๋ฐฐํ•œ๋‹ค.

 

 

- %

๋ถ€๋ชจ์š”์†Œ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ํ•˜๋Š” ๋ฐฑ๋ถ„์œจ ๋‹จ์œ„์ด๋‹ค.

 

 

 

- vw , vh

v(width) :  ํ™”๋ฉด์˜ ๋„ˆ๋น„ ๊ธฐ์ค€์œผ๋กœํ•˜๋Š” ๋ฐฑ๋ถ„์œจ ๋‹จ์œ„

v(hight) : ํ™”๋ฉด์˜ ๋†’์ด ๊ธฐ์ค€์œผ๋กœํ•˜๋Š” ๋ฐฑ๋ถ„์œจ ๋‹จ์œ„

 

 

- vmin, vmax

vmin : ํ™”๋ฉด์˜ ๋„ˆ๋น„,๋†’์ด์ค‘ ์ž‘์€๊ฐ’์„ ๊ธฐ์ค€์œผ๋กœ ํ•˜๋Š” ๋ฐฑ๋ถ„์œจ ๋‹จ์œ„

vmax : ํ™”๋ฉด์˜ ๋„ˆ๋น„ ๋†’์ด ์ค‘ ํฐ๊ฐ’์„ ๊ธฐ์ค€์œผ๋กœ ํ•˜๋Š” ๋ฐฑ๋ถ„์œจ ๋‹จ์œ„

 

 

 

์ด ๊ฒฝ์šฐ ๋„ˆ๋น„>๋†’์ด ์ด๋ฏ€๋กœ vmin์œผ๋กœ ์žก์œผ๋ฉด ๋†’์ด๊ธฐ์ค€์œผ๋กœ , vmax๋กœ ์žก์œผ๋ฉด ๋„ˆ๋น„๊ธฐ์ค€์œผ๋กœ ๋‹จ์œ„๋ฅผ ์žก์„ ์ˆ˜ ์žˆ๋‹ค.

 


๐Ÿš€ background

 

์›น ํŽ˜์ด์ง€์— ์ด๋ฏธ์ง€๋ฅผ ๋„ฃ์„๋•Œ <img>๋ง๊ณ  css์˜ background ์†์„ฑ๋„ ์‚ฌ์šฉํ•  ์ˆ˜์žˆ๋‹ค.

 

1) background-image : url("์ด๋ฏธ์ง€ํŒŒ์ผ")

 

 

2) background-repeat : ์ด๋ฏธ์ง€๋ฅผ ์–ด๋–ป๊ฒŒ ๋ฐ˜๋ณตํ•  ๊ฒƒ์ด๋ƒ?

 

์†์„ฑ ์ข…๋ฅ˜

  • repeat : ๋ฐ˜๋ณต
  • no-repeat : ๋ฐ˜๋ณต x 
  • repeat-x  : x์ถ•๋งŒ๋ฐ˜๋ณต
  • repeat-y : y์ถ•๋งŒ ๋ฐ˜๋ณต
  • round : ์ด๋ฏธ์ง€ ์ž˜๋ฆฌ์ง€ ์•Š๊ฒŒ, ํฌ๊ธฐ๋ณ€ํ™”๋ฅผ ์ฃผ์–ด ๊ฐ„๊ฒฉ์—†์ด ๋ฐ˜๋ณต
  • space : ์ด๋ฏธ์ง€ ์ž˜๋ฆฌ์ง€์•Š๊ฒŒ , ํฌ๊ธฐ ์œ ์ง€ํ•œ์ฑ„๋กœ ๊ฐ„๊ฒฉ์—†์ด ๋ฐ˜๋ณต

 

 

3)background-position  : ์ด๋ฏธ์ง€์˜ ์œ„์น˜

 

์†์„ฑ 

 - center, right, left, bottom, top

 

 - ํฌ๊ธฐ๋‹จ์œ„๋กœ ์ฃผ๊ธฐ

    ex) background-position: 10px;


 

 

 

 

Q . <img> vs background   ์†์„ฑ์ค‘ ์–ด๋–ค๊ฑธ ์จ์•ผํ• ๊นŒ?

 

- imgํƒœ๊ทธ๋Š” ์ฃผ๋กœ ๋ฐฑ์—”๋“œ ๊ฐœ๋ฐœ์ž์™€ ํ˜‘์—…ํ•ด์•ผํ•˜๋Š” ๊ณต๊ฐ„์—์„œ , background ์†์„ฑ์€ ํ˜ผ์ž ์ž‘์—…ํ•˜๋Š” ๊ณต๊ฐ„์—์„œ ์‚ฌ์šฉํ•œ๋‹ค.

- ๋˜ํ•œ img ๋Š” ์Šคํฌ๋ฆฐ๋ฆฌ๋”๊ฐ€ ์ฝ๊ณ  , background๋Š” ์ฝ์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ์›น์ ‘๊ทผ์„ฑ์„ ์ž˜ ๊ณ ๋ คํ•˜๋ฉฐ ์‚ฌ์šฉํ•ด์ค€๋‹ค.

 

 


 

๐Ÿš€ font

- font-family๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด CSS๋ฅผ ์ ์šฉํ•˜์—ฌ ๊ธ€๊ผด์„ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๋‹ค.

- ๊ธ€๊ผด์€ ์—ฌ๋Ÿฌ๊ฐœ๊ฐ€ ์ง€์ • ๊ฐ€๋Šฅํ•˜๋‹ค. (ํ•ด๋‹น ์„œ์ฒด๊ฐ€ ์—†์„๊ฒฝ์šฐ ์ฐจ์„ ์ฑ…์œผ๋กœ ์‚ฌ์šฉ)

 

 

 

์›นํฐํŠธ ์‚ฌ์ดํŠธ

 

- google fonts

https://fonts.google.com/

 

Google Fonts

Making the web more beautiful, fast, and open through great typography

fonts.google.com

 

- ๋ˆˆ๋ˆ„

https://noonnu.cc/

 

๋ˆˆ๋ˆ„

์ƒ์—…์šฉ ๋ฌด๋ฃŒํ•œ๊ธ€ํฐํŠธ ์‚ฌ์ดํŠธ

noonnu.cc

 

-๋„ค์ด๋ฒ„ ํ•œ๊ธ€ํ•œ๊ธ€ ์•„๋ฆ„๋‹ต๊ฒŒ ๊ธ€๊ผด ๋ชจ์Œ

https://hangeul.naver.com/2017/nanum

 

๋„ค์ด๋ฒ„ ๊ธ€๊ผด ๋ชจ์Œ

๋„ค์ด๋ฒ„๊ฐ€ ๋งŒ๋“  150์—ฌ์ข…์˜ ๊ธ€๊ผด์„ ํ•œ๋ฒˆ์— ๋งŒ๋‚˜๋ณด์„ธ์š”

hangeul.naver.com

 

- Adobe Fonts

https://fonts.adobe.com/

 

Adobe Fonts

Adobe Fonts partners with the world’s leading type foundries to bring thousands of beautiful fonts to designers every day. No need to worry about licensing, and you can use fonts from Adobe Fonts on the web or in desktop applications.

fonts.adobe.com

 

 

 


 

 

์ถ”์ฒœ ์›นํฐํŠธ

https://fonts.google.com/noto/specimen/Noto+Sans+KR 

 

Google Fonts

Making the web more beautiful, fast, and open through great typography

fonts.google.com

https://noonnu.cc/font_page/366

 

๋ˆˆ๋ˆ„

Gmarket Sans M - G๋งˆ์ผ“

noonnu.cc

https://spoqa.github.io/spoqa-han-sans//ko-KR/

 

Spoqa Han Sans Neo

Spoqa unveil the new Spoqa Han Sans Neo, which has evolved in many ways. | ์—ฌ๋Ÿฌ๋ชจ๋กœ ๊ฐœ์„ ์„ ๊ฑฐ์ณ ์ง„ํ™”ํ•œ ์Šคํฌ์นด ํ•œ ์‚ฐ์Šค ๋„ค์˜ค๋ฅผ ๊ณต๊ฐœํ•ฉ๋‹ˆ๋‹ค. | ใ“ใ‚Œใพใงใ„ใ‚ใ„ใ‚ๆ”นๅ–„ใ—ใฆ้€ฒๅŒ–ใ—ใŸๆ–ฐใ—ใ„ใ‚นใƒใ‚ซใƒผใƒใƒณใ‚ตใƒณใ‚นใƒใ‚ช

spoqa.github.io

https://noonnu.cc/font_page/432

 

๋ˆˆ๋ˆ„

๋„ฅ์Šจ Lv.1 ๊ณ ๋”• Regular - ๋„ฅ์Šจ

noonnu.cc

https://hangeul.naver.com/2021/fonts/nanum

 

๋„ค์ด๋ฒ„ ๊ธ€๊ผด ๋ชจ์Œ

๋„ค์ด๋ฒ„๊ฐ€ ๋งŒ๋“  150์—ฌ์ข…์˜ ๊ธ€๊ผด์„ ํ•œ๋ฒˆ์— ๋งŒ๋‚˜๋ณด์„ธ์š”

hangeul.naver.com

https://noonnu.cc/font_page/322

 

๋ˆˆ๋ˆ„

์ฟ ํ‚ค๋Ÿฐ Bold - ๋ฐ๋ธŒ์‹œ์Šคํ„ฐ์ฆˆ(์ฃผ)

noonnu.cc

https://noonnu.cc/font_page/630

 

๋ˆˆ๋ˆ„

Rix์—ด์ •๋„์ฒด - (์ฃผ)ํฐํŠธ๋ฆญ์Šค

noonnu.cc

 

 


ํด๋ฆญํ•˜๋ฉด ํฌ์ŠคํŒ…๊ธ€๋กœ ๋„˜์–ด๊ฐ‘๋‹ˆ๋‹ค.

 

โฃ๏ธ  overflow : hidden vs display : none ์ฐจ์ด

 

 

โฃ๏ธ ์ค‘์•™์ •๋ ฌ ์ฝ”๋“œ๋ชจ์Œ

 

 

โฃ๏ธ img์š”์†Œ ํ•˜๋‹จ์— ์ƒ๊ธฐ๋Š” ๋นˆ๊ณต๊ฐ„์€ ์™œ ์ƒ๊ธฐ๋‚˜์š”?

 

 

๐ŸŒˆ๊ทธ๋ฐ–์—

 

๋‹ฌ๋ ฅ ๊ณผ์ œ์ค‘ ํ•œ๋ถ„๊ป˜์„œ ํ•˜๋‹จ์˜ ์›”์„ ํด๋ฆญํ•˜๋ฉด ๊ทธ ์›”์— ๋งž๊ฒŒ๋‹ฌ๋ ฅ์ด ๋ฐ”๋€Œ๋Š” ์ฝ”๋”ฉ์„ ํ•ด์ฃผ์…จ๋‹ค.

๋„ˆ๋ฌด ์˜ˆ์˜๊ณ  ์ž˜ํ•˜์…จ๋‹ค๋ผ๊ณ  ์ƒ๊ฐํ–ˆ์ง€๋งŒ ์›น์ ‘๊ทผ์„ฑ์— ์–ด๊ธ‹๋‚ ์ˆ˜ ์žˆ๋‹ค๋Š” ์‚ฌ์‹ค์„ ์•Œ๊ฒŒ๋˜์—ˆ๋‹ค.

๋ฒ„ํŠผ์„ ๋‹จ์ˆœํžˆ ์ƒ‰์œผ๋กœ๋งŒ ๋ฐ”๊พธ์ง€ ์•Š๊ณ  ํ…Œ๋‘๋ฆฌ๋‚˜ ๊ทธ๋ฆผ์ž๋ฅผ ๋„ฃ์–ด์ค˜์•ผ ์Šคํฌ๋ฆฐ ๋ฆฌ๋”๊ฐ€ ์ฝ๋Š”๋‹ค๊ณ  ํ•œ๋‹ค.

 

๐Ÿ”ฅ ํšŒ๊ณ 

์˜ค๋Š˜์€ ๊ต‰์žฅํžˆ ํฅ๋ฏธ๋กœ์šด ๋‚ด์šฉ๋“ค์ด ๋งŽ์•˜๋‹ค. img์š”์†Œํ•˜๋‹จ์— ์™œ ๋นˆ๊ณต๊ฐ„์ด ์ƒ๊ธฐ๋Š”์ง€ , line height์™€ reading ์˜์—ญ๊นŒ์ง€ 

์ง€๊ธˆ๊นŒ์ง€ ์ฝ”๋”ฉํ•˜๋ฉด์„œ ๊ทธ๋ƒฅ ์ง€๋‚˜์ณค๋˜ ๋ถ€๋ถ„์— ๋Œ€ํ•˜์—ฌ ์›๋ฆฌ๋ฅผ ํŒŒ์•…ํ•˜๊ณ  ์ด๋ฅผ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜์—ˆ๋‹ค. (๊ทธ๋ƒฅ ๋‹ค๋ฅธ ์ฝ”๋“œ๋กœ ๋ง‰๋Š”์‹์œผ๋กœ..ใ…‹ใ…‹ใ…‹ใ…‹)

 

์ด ๋ถ€๋ถ„ ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ css๋ฅผ ๋‹ค๋ฃจ๋ฉฐ ์™œ ์ด๋ ‡๊ฒŒ ๋˜๋Š”์ง€ ์•Œ์ญ๋‹ฌ์ญํ•œ ๋‚ด์šฉ์„ ์ •๋ฆฌํ•ด์ฃผ์‹  ๋น”์บ ํ”„ (์‚ฌ๋ž‘ํ•ฉ๋‹ˆ๋‹ค ์ข…์ฐฌ๋‹˜^^)์˜์ƒ๋„ ๋ณด๊ณ  ์ •๋ฆฌํ•ด์•ผ๊ฒ ๋‹ค.

 

https://www.youtube.com/watch?v=p6VxdiNTrGg&list=PLMv8nY90ATZVSzlzQ4vsArHQGu-Nq7x08