MapleStory Finger Point Cute Line Smiley Blinking Hello Kitty Angel MapleStory Finger Point

๐Ÿ’ŽWEB/Web ๊ฐœ๋…์ •๋ฆฌ

หšโ‚Šโœฉโ€งโ‚Š Media Queries - @media หšโ‚Šโœฉโ€งโ‚Š

HYEJU01 2023. 7. 7. 16:50

 

 

๋ฐ˜์‘ํ˜•์›นํŽ˜์ด์ง€ ๋ฅผ ๋งŒ๋“ค๋•Œ ์‚ฌ์šฉํ•œ๋‹ค. 

ํŠน์ • ๋ถ€๋ถ„์— ๋ฏธ๋””์–ด์ฟผ๋ฆฌ๋กœ BreakPoints ๋ฅผ ์„ค์ •ํ•ด์„œ ๋ฐ˜์‘ํ˜• ์›นํŽ˜์ด์ง€๋ฅผ ๋งŒ๋“ฌ

  • width and height of the viewport - ๋ทฐํฌํŠธ์˜ ๋„ˆ๋น„์™€ ๋†’์ด
  • width and height of the device - ๊ธฐ๊ธฐ์˜ ๋„ˆ๋น„์™€ ๋†’์ด 
  • orientation (is the tablet/phone in landscape or portrait mode?) - ๋ฐฉํ–ฅ
  • resolution - ํ•ด๊ฒฐ

 

1. ์žฅ์น˜ (๋ทฐํฌํŠธ ํฌ๊ธฐ๊ฐ€ ๋‹ค๋ฅธ ๊ฒฝ์šฐ)

/* Extra small devices (phones, 600px and down) */
@media only screen and (max-width: 600px) {...}

/* Small devices (portrait tablets and large phones, 600px and up) */
@media only screen and (min-width: 600px) {...}

/* Medium devices (landscape tablets, 768px and up) */
@media only screen and (min-width: 768px) {...}

/* Large devices (laptops/desktops, 992px and up) */
@media only screen and (min-width: 992px) {...}

/* Extra large devices (large laptops and desktops, 1200px and up) */
@media only screen and (min-width: 1200px) {...}

 

 

2. ๋ฉ”๋‰ด

float : left ๋ฅผ none ๊ฐ’์œผ๋กœ ๋ฐ”๊ฟ” ๋‹ค์‹œ ์„ธ๋กœ๋กœ ๋ณผ ์ˆ˜ ์žˆ๊ฒŒ ํ•จ
๋˜ width ๊ฐ’์„ 100%์œผ๋กœ ํ•˜์—ฌ ํ™”๋ฉด์— ๊ฝ‰ ์ฐจ๊ฒŒ ํ•˜์˜€์Œ

 

/* The navbar container */
.topnav {
  overflow: hidden;
  background-color: #333;
}

/* Navbar links */
.topnav a {
  float: left;
  display: block;
  color: white;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
}

/* On screens that are 600px wide or less, make the menu links stack 
on top of each other instead of next to each other */
@media screen and (max-width: 600px) {
  .topnav a {
    float: none;
    width: 100%;
  }
}

 

 

 

 

3. ์—ด Columns  

+ ์š”์ฆ˜์—๋Š” flex ๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค. (CSS Flexbox)

/* Container for flexboxes */
.row {
  display: flex;
  flex-wrap: wrap;
}

/* Create four equal columns */
.column {
  flex: 25%;
  padding: 20px;
}

/* On screens that are 992px wide or less, go from four columns to two columns */
@media screen and (max-width: 992px) {
  .column {
    flex: 50%;
  }
}

/* On screens that are 600px wide or less, make the columns stack
on top of each other instead of next to each other */
@media screen and (max-width: 600px) {
  .row {
    flex-direction: column;
  }
}

 

 

width ๊ฐ’์„ %๋กœ ์กฐ์ •ํ•˜์—ฌ ํฌ๊ธฐ๋ณ„๋กœ ์—ด ๋ชจ์–‘์„ ๋ฐ”๊ฟˆ

/* Create four equal columns that floats next to each other */
.column {
  float: left;
  width: 25%;
}

/* On screens that are 992px wide or less, go from four columns to two columns */
@media screen and (max-width: 992px) {
  .column {
    width: 50%;
  }
}

/* On screens that are 600px wide or less, make the columns stack 
on top of each other instead of next to each other */
@media screen and (max-width: 600px) {
  .column {
    width: 100%;
  }
}

 

 

 

4. ์š”์†Œ ์ˆจ๊ธฐ๊ธฐ

display : none ๊ฐ’์„ ์ด์šฉํ•˜๋ฉด ํŠน์ • ํฌ๊ธฐ์—์„œ ์š”์†Œ๋ฅผ ์ˆจ๊ธธ ์ˆ˜ ์žˆ๋‹ค.

display: none;

 

 

5. ๋ฐฉํ–ฅ ๋ณ„

orientation ๊ฐ’์„ ์‚ฌ์šฉํ•˜๋ฉด ๋ฐฉํ–ฅ๋ณ„๋กœ ์†์„ฑ์„ ๋ฐ”๊ฟ€ ์ˆ˜ ์žˆ๋‹ค.

@media only screen and (orientation: landscape) {
  body {
    background-color: lightblue;
  }
}

 

 

6.์ตœ๋Œ€ ์ตœ์†Œ๊ฐ’ ์ง€์ •

max-width and min-width ๊ฐ’์„ ํ†ตํ•ด์„œ ์ตœ์†Œ,์ตœ๋Œ€ ๋„ˆ๋น„๋ฅผ ์„ค์ • ํ•  ์ˆ˜ ์žˆ์Œ
์„ค์ •ํ•œ ๊ฐ’์—์„œ๋งŒ ์†์„ฑ์ด ์ž‘๋™ํ•จ.

์ถ”๊ฐ€๊ฐ’์„ ์‚ฌ์šฉํ•  ์‹œ์—๋Š” OR ์—ฐ์‚ฐ์ž ์ฒ˜๋Ÿผ ์ž‘๋™ํ•จ. (๋‘˜ ์ค‘ ํ•˜๋‚˜ ์ฐธ์ด๋ฉด ์ฐธ)

@media screen and (max-width: 900px) and (min-width: 600px) {
}

/* ์ถ”๊ฐ€ ๊ฐ’ ์‚ฌ์šฉ, OR ์—ฐ์‚ฐ์ž ์ฒ˜๋Ÿผ ์ž‘๋™ */
@media screen and (max-width: 900px) and (min-width: 600px), (min-width: 1100px) {
}