½ÃÀÛÆäÀÌÁö·Î Áñ°Üã±âÃß°¡
·Î±×ÀÎ
ȸ¿ø°¡ÀÔ l Ã⼮üũ l ¸¶ÀÌÆäÀÌÁö l CGIMALL
Flexbox Cheatsheet (Ç÷º½º¹Ú½º ġƮ½ÃÆ®) : happycgi
ÀÚ·á½Ç »çÀÌÆ®µî·Ï ·©Å·100 ÇÁ·Î±×·¥¸®ºä °ü¸®ÀÚÃßõÀÚ·á Ãʺ¸°¡À̵å
Ä¿¹Â´ÏƼ
Àüü ÆîÃ帱â
Äü¸Þ´º¸µÅ© jquery , CSS , PHP , Javascript , ¹«·áÆùÆ® , ASP
»ó¼¼°Ë»ö
Ȩ > CSS > ±âº» ¼Ò½º > Flexbox Cheatsheet (Ç÷º½º¹Ú½º ġƮ½ÃÆ®) »ó¼¼Á¤º¸
»çÀÌÆ®µî·Ï
Ŭ¶ó¿ìµåű×
Javascript
HTML
CSS
PHP
API
asp
MYSQL
jquery
slide
image
¸Þ´º
Mobile
°Ô½ÃÆÇ
ÇöÀçÁ¢¼ÓÀÚ ¸í »õ·Î°íħ
Flexbox Cheatsheet (Ç÷º½º¹Ú½º ġƮ½ÃÆ®)
¼Ò½ºÅë°èÁ¤º¸ ¿À·ù½Å°í ¹× ¹®ÀÇ
ÇØÇÇÆÀ
³×ƼÁð
Æ®À§ÅÍ·Î º¸³»±â ÆäÀ̽ººÏÀ¸·Î º¸³»±â
¼Ò½ººÐ·ù ±âº» ¼Ò½º
´Ù¿î·Îµå Ƚ¼ö 13 ȸ
°£´Ü¼³¸í Flexbox¸¦ ½±°í Á÷°üÀûÀ¸·Î ÀÌÇØÇÒ ¼ö ÀÖµµ·Ï, °¢ ¼Ó¼ºº°·Î ½Ã°¢Àû ¿¹Á¦¿Í °á°ú¸¦ º¸¿©ÁÖ´Â °¡À̵å
Æò°¡Çϱâ ÈǸ¢ÇÔ ¸Å¿ìÁÁÀ½ ÁÁÀ½ ±¦ÂúÀ½ º¸Åë º°·Î
ȨÆäÀÌÁö¹Ù·Î°¡±â ¼Ò½º´Ù¿î·Îµå µ¥¸ð ¹Ì¸®º¸±â ½ºÅ©·¦Çϱâ

FlexboxÀÇ ´Ù¾çÇÑ ¼Ó¼ºÀ» ½Ã°¢ÀûÀ¸·Î ÀÌÇØÇÒ ¼ö ÀÖ°Ô ±¸¼ºµÈ °¡À̵å·Î, ½Ç½ÀÇÏ¸ç ¹è¿ï ¼ö ÀÖ´Â ÀÚ·áÀÔ´Ï´Ù.

ÀÌ ÀÚ·á´Â FlexboxÀÇ ±âº» °³³äÀÎ display ¼³Á¤ºÎÅÍ ¹æÇâÀ» °áÁ¤ÇÏ´Â flex-direction, ¿©·¯ ÁÙ ¹èÄ¡¸¦ À§ÇÑ flex-wrap, ÁÖ Ãà Á¤·ÄÀ» À§ÇÑ justify-content, ±³Â÷ Ãà Á¤·ÄÀ» À§ÇÑ align-items¿Í align-content °°Àº ÇÙ½É ¼Ó¼ºµéÀ» Á÷°üÀûÀ¸·Î º¸¿©ÁÝ´Ï´Ù. ¶ÇÇÑ, ¾ÆÀÌÅÛ ¼ø¼­¸¦ ¹Ù²Ù´Â order, °ø°£ ºñÀ²À» Á¶ÀýÇÏ´Â flex-grow¿Í flex-shrink, ¾ÆÀÌÅÛ ±âº» Å©±â¸¦ ¼³Á¤ÇÏ´Â flex-basis¿Í À̸¦ ÇÑ ¹ø¿¡ ¾²´Â flex ´ÜÃà ¼Ó¼ºµµ ´Ù·ç¸ç, °³º° ¾ÆÀÌÅÛ Á¤·ÄÀ» À§ÇÑ align-self±îÁö ¼³¸íÇÕ´Ï´Ù. °¢ ¼Ó¼ºÀÌ ½ÇÁ¦·Î ¾î¶»°Ô ¹èÄ¡¿¡ ¿µÇâÀ» ÁÖ´ÂÁö ¿¹Á¦¸¦ ÅëÇØ ¹Ù·Î È®ÀÎÇÒ ¼ö ÀÖ¾î, Flexbox¸¦ óÀ½ ¹è¿ì°Å³ª Çò°¥¸®´Â »ç¶÷¿¡°Ô ¸Å¿ì À¯¿ëÇÑ ÀÚ·áÀÔ´Ï´Ù.



HTML ±¸Á¶

<div class="container">

  <div class="list">

    <div class="list-item">

      <div class="icon">

        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">

          <path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z" stroke-width="2"/>

          <path d="M13 2v7h7" stroke-width="2"/>

        </svg>

      </div>

      <div class="content">

        <div class="title">Camping</div>

        <div class="subtitle">Yosemite Park</div>

      </div>

      <div class="date">5 August</div>

    </div>


    <div class="list-item">

      <div class="icon">

        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">

          <path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z" stroke-width="2"/>

          <circle cx="12" cy="10" r="3" stroke-width="2"/>

        </svg>

      </div>

      <div class="content">

        <div class="title">Boating</div>

        <div class="subtitle">Lake Tahoe Park</div>

      </div>

      <div class="date">2 August</div>

    </div>


    <div class="list-item">

      <div class="icon">

        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">

          <path d="M8.5 14.5A2.5 2.5 0 0011 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 11-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 002.5 2.5z" stroke-width="2"/>

        </svg>

      </div>

      <div class="content">

        <div class="title">Barbeue</div>

        <div class="subtitle">Greenfield Shores</div>

      </div>

      <div class="date">28 July</div>

    </div>

  </div>


  <button class="show-hide-btn">

    <span class="show">Show All</span>

    <span class="hide">Hide</span>

    <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor">

      <path d="M4 6l4 4 4-4" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>

    </svg>

  </button>

</div>



CSS ¼Ò½º

body {

  font-family: system-ui, -apple-system, sans-serif;

  display: grid;

  place-items: center;

  min-height: 100vh;

  margin: 0;

  background: #fafafa;

}


.container {

  background: white;

  border-radius: 24px;

  padding: 24px;

  width: 400px;

  box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.1) 0px 2px 4px -2px;

  view-transition-name: container;


  .list-item:nth-child(1) {

    margin-bottom: -21.5%;

  }


  .list-item:nth-child(2) {

    margin-bottom: -21.5%;

    transform: scale(0.95);

  }


  .list-item:nth-child(3) {

    transform: scale(0.9);

  }


  .hide {

    display: none;

  }


  &.expanded {

    .list-item:nth-child(1),

    .list-item:nth-child(2) {

      margin-bottom: 0;

      transform: scale(1);

    }


    .list-item:nth-child(3) {

      transform: scale(1);

    }


    .show {

      display: none;

    }


    .hide {

      display: block;

    }


    .show-hide-btn svg {

      transform: rotate(180deg);

      transition: transform 0.6s;

    }

  }

}


.list {

  display: flex;

  flex-direction: column;

  gap: 16px;

  view-transition-name: list;

}


.list-item {

  display: flex;

  align-items: center;

  gap: 16px;

  padding: 16px;

  background: white;

  border-radius: 16px;

  border: 1px solid #e4e4e7;

  cursor: pointer;

  box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.1) 0px 2px 4px -2px;

}


.list-item:nth-child(1) {

  view-transition-name: list-item-1;

  z-index: 2;

}


.list-item:nth-child(2) {

  view-transition-name: list-item-2;

  z-index: 1;

}


.list-item:nth-child(3) {

  view-transition-name: list-item-3;

  z-index: 0;

}


.icon {

  width: 48px;

  height: 48px;

  background: #18181b;

  border-radius: 12px;

  display: grid;

  place-items: center;

}


.icon svg {

  width: 24px;

  height: 24px;

  color: white;

}


.content {

  display: flex;

  flex-direction: column;

  gap: 4px;

  flex: 1;

}


.title {

  font-size: 16px;

  font-weight: 500;

  color: #18181b;

}


.subtitle {

  font-size: 14px;

  color: #71717a;

}


.date {

  font-size: 14px;

  color: #71717a;

  text-align: right;

}


.show-hide-btn {

  display: flex;

  align-items: center;

  justify-content: center;

  gap: 8px;

  padding: 12px 24px;

  margin: 8px auto 0 auto;

  width: 140px;

  background: none;

  color: #71717a;

  border: 1px solid #e4e4e7;

  border-radius: 24px;

  font-weight: 500;

  font-size: 14px;

  cursor: pointer;

  view-transition-name: show-hide-btn;


  span {

    display: inline-block;

    text-align: center;

    width: fit-content;

  }


  svg {

    transition: transform 0.3s;

    view-transition-name: show-hide-btn-icon;

  }

}


.container.expanded .show-hide-btn svg {

  transform: rotate(-180deg);

}


.show,

.hide {

  width: fit-content;

  view-transition-name: button-label;

}


@keyframes fade-out {

  0% {

    opacity: 1;

  }

  10% {

    opacity: 0;

  }

  100% {

    opacity: 0;

  }

}


::view-transition-group(*) {

  animation-duration: 0.6s;

  animation-timing-function: linear(0, 0.402 7.4%, 0.711 15.3%, 0.929 23.7%, 1.008 28.2%, 1.067 33%, 1.099 36.9%, 1.12 41%, 1.13 45.4%, 1.13 50.1%, 1.111 58.5%, 1.019 83.2%, 1.004 91.3%, 1);

}


::view-transition-old(*),

::view-transition-new(*) {

  height: 100%;

}


::view-transition-old(button-label),

::view-transition-new(button-label) {

  width: fit-content; 

}


::view-transition-old(button-label) {

  animation-name: fade-out;

  animation-duration: 0.6s;

}



JS ¼Ò½º

body {

  font-family: system-ui, -apple-system, sans-serif;

  display: grid;

  place-items: center;

  min-height: 100vh;

  margin: 0;

  background: #fafafa;

}


.container {

  background: white;

  border-radius: 24px;

  padding: 24px;

  width: 400px;

  box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.1) 0px 2px 4px -2px;

  view-transition-name: container;


  .list-item:nth-child(1) {

    margin-bottom: -21.5%;

  }


  .list-item:nth-child(2) {

    margin-bottom: -21.5%;

    transform: scale(0.95);

  }


  .list-item:nth-child(3) {

    transform: scale(0.9);

  }


  .hide {

    display: none;

  }


  &.expanded {

    .list-item:nth-child(1),

    .list-item:nth-child(2) {

      margin-bottom: 0;

      transform: scale(1);

    }


    .list-item:nth-child(3) {

      transform: scale(1);

    }


    .show {

      display: none;

    }


    .hide {

      display: block;

    }


    .show-hide-btn svg {

      transform: rotate(180deg);

      transition: transform 0.6s;

    }

  }

}


.list {

  display: flex;

  flex-direction: column;

  gap: 16px;

  view-transition-name: list;

}


.list-item {

  display: flex;

  align-items: center;

  gap: 16px;

  padding: 16px;

  background: white;

  border-radius: 16px;

  border: 1px solid #e4e4e7;

  cursor: pointer;

  box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.1) 0px 2px 4px -2px;

}


.list-item:nth-child(1) {

  view-transition-name: list-item-1;

  z-index: 2;

}


.list-item:nth-child(2) {

  view-transition-name: list-item-2;

  z-index: 1;

}


.list-item:nth-child(3) {

  view-transition-name: list-item-3;

  z-index: 0;

}


.icon {

  width: 48px;

  height: 48px;

  background: #18181b;

  border-radius: 12px;

  display: grid;

  place-items: center;

}


.icon svg {

  width: 24px;

  height: 24px;

  color: white;

}


.content {

  display: flex;

  flex-direction: column;

  gap: 4px;

  flex: 1;

}


.title {

  font-size: 16px;

  font-weight: 500;

  color: #18181b;

}


.subtitle {

  font-size: 14px;

  color: #71717a;

}


.date {

  font-size: 14px;

  color: #71717a;

  text-align: right;

}


.show-hide-btn {

  display: flex;

  align-items: center;

  justify-content: center;

  gap: 8px;

  padding: 12px 24px;

  margin: 8px auto 0 auto;

  width: 140px;

  background: none;

  color: #71717a;

  border: 1px solid #e4e4e7;

  border-radius: 24px;

  font-weight: 500;

  font-size: 14px;

  cursor: pointer;

  view-transition-name: show-hide-btn;


  span {

    display: inline-block;

    text-align: center;

    width: fit-content;

  }


  svg {

    transition: transform 0.3s;

    view-transition-name: show-hide-btn-icon;

  }

}


.container.expanded .show-hide-btn svg {

  transform: rotate(-180deg);

}


.show,

.hide {

  width: fit-content;

  view-transition-name: button-label;

}


@keyframes fade-out {

  0% {

    opacity: 1;

  }

  10% {

    opacity: 0;

  }

  100% {

    opacity: 0;

  }

}


::view-transition-group(*) {

  animation-duration: 0.6s;

  animation-timing-function: linear(0, 0.402 7.4%, 0.711 15.3%, 0.929 23.7%, 1.008 28.2%, 1.067 33%, 1.099 36.9%, 1.12 41%, 1.13 45.4%, 1.13 50.1%, 1.111 58.5%, 1.019 83.2%, 1.004 91.3%, 1);

}


::view-transition-old(*),

::view-transition-new(*) {

  height: 100%;

}


::view-transition-old(button-label),

::view-transition-new(button-label) {

  width: fit-content; 

}


::view-transition-old(button-label) {

  animation-name: fade-out;

  animation-duration: 0.6s;

}


 

³×ƼÁð ÀÇ°ß   ÀÌ¿ëÇϽŠÀÚ·áÀÇ Èı⸦ ÀÚÀ¯·Ó°Ô ÀÛ¼ºÇϼ¼¿ä. (»ó¾÷ÀûÀÎ ±¤°í ¹× µµ¹è¼º ±Û µîÀº »çÀüÅ뺸¾øÀÌ »èÁ¦µÉ ¼ö ÀÖ½À´Ï´Ù.)
³»¿ë ¾ÆÀ̵ð Àǰ߳²±â±â
µî·ÏµÈ ÀǰßÀÌ ¾ø½À´Ï´Ù.
1
À̸§
³»¿ë
:³×¸Â¾Æ¿ä: :È­³ª´Â±º¿ä: :Àá¿Í: :¿ì¿ïÇØ: :À̰ǾƳÄ: :¿ÕÇÏÇÏ: ¿Õ¿ôÀ½~ ³î·¥~
Æò°¡Çϱâ ÈǸ¢ÇÔ ¸Å¿ìÁÁÀ½ ÁÁÀ½ ±¦ÂúÀ½ º¸Åë º°·Î
µµ¹è¹æÁöŰ
 81871630 º¸ÀÌ´Â µµ¹è¹æÁö۸¦ ÀÔ·ÂÇϼ¼¿ä.