๐Ÿ’ซ ๋ชจ๋˜ ์›น์—์„œ ์‚ฌ์šฉํ•˜๋Š” ๋‹จ์œ„ ์ •๋ฆฌ

.box {
  width : 16px;/* ๊ธฐ๋ณธ px ๋‹จ์œ„ */
  width : 1.5rem;/* htmlํƒœ๊ทธ ํ˜น์€ ๊ธฐ๋ณธ ํฐํŠธ์‚ฌ์ด์ฆˆ์˜ 1.5๋ฐฐ */
  width : 2em;/* ๋‚ด ํฐํŠธ์‚ฌ์ด์ฆˆ ํ˜น์€ ์ƒ์œ„์š”์†Œ ํฐํŠธ์‚ฌ์ด์ฆˆ์˜ 2๋ฐฐ */
  width : 50vw;/* ๋ธŒ๋ผ์šฐ์ €(viewport) ํ™”๋ฉด ํญ์˜ 50% */
  width : 50vh;/* ๋ธŒ๋ผ์šฐ์ €(viewport) ํ™”๋ฉด ๋†’์ด์˜ 50% */
}

๐Ÿ’ซ ๋ฐ˜์‘ํ˜• ์›น์„ ๋งŒ๋“ค ๋•Œ head ํƒœ๊ทธ์— ๋“ค์–ด๊ฐ€์•ผ ํ•  ๋‚ด์šฉ

<!-- ์ฒ˜์Œ ๋กœ๋“œ๋  ๋•Œ ๋ฐฐ์œจ 1.0, ์‚ฌ์šฉ์ž๊ฐ€ ํ™•๋Œ€/์ถ•์†Œ ๊ฐ€๋Šฅ -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- ์‚ฌ์šฉ์ž๊ฐ€ ํ™•๋Œ€/์ถ•์†Œ ๋ถˆ๊ฐ€๋Šฅ -->
<meta name="viewport" content="width=device-width, user-scalable=no">

๐Ÿ’ซ media query ์‚ฌ์šฉํ•˜๋Š” ๋ฒ•

@media screen and (max-width : 1200px) {
  .box {
    font-size : 40px;
  }
}
@media screen and (max-width : 768px) {
  .box {
    font-size : 30px;
  }
}
  • CSS ํŒŒ์ผ ์ตœํ•˜๋‹จ์— ์‚ฌ์šฉ
    โ†’ "ํ˜„์žฌ ๋ธŒ๋ผ์šฐ์ €์˜ ํญ์ด 1200px ์ดํ•˜์ผ ๊ฒฝ์šฐ์— ์•ˆ์— ์žˆ๋Š” class๋ฅผ ์ ์šฉ"

๐Ÿ’ซ ๊ถŒ์žฅ Breakpoint

breakpoint : media query ๋ฌธ๋ฒ• max-width ์•ˆ์— ๋„ฃ๋Š” ๋ธŒ๋ผ์šฐ์ € ํญ
- ๋งŽ์€ ์‚ฌ๋žŒ๋“ค์ด ์‚ฌ์šฉํ•˜๋Š” breakpoint : 1200px / 992px / 768px / 576px

๐Ÿ’ซ ์˜ค๋Š˜์˜ ์ˆ™์ œ : ๋ฐ˜์‘ํ˜• ๋ ˆ์ด์•„์›ƒ ๋งŒ๋“ค๊ธฐ

  • 1x : ๋ชจ๋ฐ”์ผ
  • 0.5x : ํƒœ๋ธ”๋ฆฟ
  • 0.25x: ์ปดํ“จํ„ฐ

See the Pen
๋ฐ˜์‘ํ˜• ๋ ˆ์ด์•„์›ƒ ์ˆ™์ œ
by dozzs (@dozzs)
on CodePen.

By Dozzing

๋‹ต๊ธ€ ๋‚จ๊ธฐ๊ธฐ

์ด๋ฉ”์ผ ์ฃผ์†Œ๋Š” ๊ณต๊ฐœ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํ•„์ˆ˜ ํ•„๋“œ๋Š” *๋กœ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค