μ£Όλ‹ˆμ–΄ 개발자의 개인 곡뢀 과정을 κΈ°λ‘ν•©λ‹ˆλ‹€.

Flexbox λž€?

일λͺ… flexbox라 λΆˆλ¦¬λŠ” Flexible Box module은 flexbox μΈν„°νŽ˜μ΄μŠ€ λ‚΄μ˜ μ•„μ΄ν…œ κ°„ 곡간 λ°°λΆ„κ³Ό κ°•λ ₯ν•œ μ •λ ¬ κΈ°λŠ₯을 μ œκ³΅ν•˜κΈ° μœ„ν•œ 1차원 λ ˆμ΄μ•„μ›ƒ λͺ¨λΈ. flexboxλ₯Ό 1차원이라 μΉ­ν•˜λŠ” 것은, λ ˆμ΄μ•„μ›ƒμ„ λ‹€λ£° λ•Œ ν•œ λ²ˆμ— ν•˜λ‚˜μ˜ 차원(ν–‰μ΄λ‚˜ μ—΄)λ§Œμ„ λ‹€λ£¬λ‹€λŠ” λœ»μ΄λ‹€.

✨참고✨ 2차원 λͺ¨λΈ: ν–‰κ³Ό 열을 ν•¨κ»˜ μ‘°μ ˆν•˜λŠ” CSS κ·Έλ¦¬λ“œ λ ˆμ΄μ•„μ›ƒ

πŸš©μ§‘μ€‘! flexboxλ₯Ό μ μš©ν•˜λ €λ©΄, μ μš©ν•˜λ €λŠ” μš”μ†Œμ— display: flex;λ₯Ό μ μš©μ‹œν‚¨λ‹€

β—‹ justify-content

  • μš”μ†Œμ˜ κ°€λ‘œ μ •λ ¬
  • 5개의 κ°’μœΌλ‘œ κ°€λ‘œλ‘œ μ •λ ¬ μ‹œν‚¬ 수 μžˆλ‹€

    • flex-start μš”μ†Œλ“€μ„ μ»¨ν…Œμ΄λ„ˆμ˜ μ™Όμͺ½μœΌλ‘œ μ •λ ¬.
    • flex-end μš”μ†Œλ“€μ„ μ»¨ν…Œμ΄λ„ˆμ˜ 였λ₯Έμͺ½μœΌλ‘œ μ •λ ¬.
    • center μš”μ†Œλ“€μ„ μ»¨ν…Œμ΄λ„ˆμ˜ κ°€μš΄λ°λ‘œ μ •λ ¬.
    • space-between μš”μ†Œλ“€ 사이에 λ™μΌν•œ 간격을 λ‘”λ‹€.
    • space-around μš”μ†Œλ“€ μ£Όμœ„μ— λ™μΌν•œ 간격을 λ‘”λ‹€.
  • μ˜ˆμ‹œ
#pond {
  display: flex;
  justify-content: flex-end;
}


  • μ˜ˆμ‹œ2
#pond {
  display: flex;
  justify-content: center;
}


  • μ˜ˆμ‹œ3
#pond {
  display: flex;
  justify-content: space-around;
}


  • μ˜ˆμ‹œ4
#pond {
  display: flex;
  justify-content: space-between;
}



β—‹ align-items

  • μš”μ†Œμ˜ μ„Έλ‘œ μ •λ ¬
  • 5개의 κ°’μœΌλ‘œ κ°€λ‘œλ‘œ μ •λ ¬ μ‹œν‚¬ 수 μžˆλ‹€

    • flex-start μš”μ†Œλ“€μ„ μ»¨ν…Œμ΄λ„ˆμ˜ κΌ­λŒ€κΈ°λ‘œ μ •λ ¬.
    • flex-end μš”μ†Œλ“€μ„ μ»¨ν…Œμ΄λ„ˆμ˜ λ°”λ‹₯으둜 μ •λ ¬.
    • center μš”μ†Œλ“€μ„ μ»¨ν…Œμ΄λ„ˆμ˜ μ„Έλ‘œμ„  μƒμ˜ κ°€μš΄λ°λ‘œ μ •λ ¬.
    • baseline μš”μ†Œλ“€μ„ μ»¨ν…Œμ΄λ„ˆμ˜ μ‹œμž‘ μœ„μΉ˜μ— μ •λ ¬.
    • stretch μš”μ†Œλ“€μ„ μ»¨ν…Œμ΄λ„ˆμ— λ§žλ„λ‘ λŠ˜λ¦°λ‹€.
  • μ˜ˆμ‹œ
#pond {
  display: flex;
  align-items: flex-end;
}


● justify-content+align-items

#pond {
  display: flex;
  align-items: center;
  justify-content: center;
}



β—‹ flex-direction

  • μš”μ†Œμ˜ μ •λ ¬ λ°©ν–₯을 지정
  • 4개의 κ°’μœΌλ‘œ 지정할 수 μžˆλ‹€

    • row μš”μ†Œλ“€μ„ ν…μŠ€νŠΈμ˜ λ°©ν–₯κ³Ό λ™μΌν•˜κ²Œ μ •λ ¬.
    • row-reverse μš”μ†Œλ“€μ„ ν…μŠ€νŠΈμ˜ λ°˜λŒ€ λ°©ν–₯으둜 μ •λ ¬.
    • column μš”μ†Œλ“€μ„ μœ„μ—μ„œ μ•„λž˜λ‘œ μ •λ ¬.
    • column-reverse μš”μ†Œλ“€μ„ μ•„λž˜μ—μ„œ μœ„λ‘œ μ •λ ¬.
  • μ˜ˆμ‹œ
#pond {
  display: flex;
  flex-direction: column;
}


● flex-direction+justify-content

FROGGY 단계 10

#pond {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
}


FROGGY 단계 12

#pond {
  display: flex;
  flex-direction: column-reverse;
  justify-content: space-between;
}


FROGGY 단계 13

#pond {
  display: flex;
  flex-direction: row-reverse;
  justify-content: center;
  align-items: flex-end;
}



β—‹ order

  • 각 μš”μ†Œμ˜ κ°œλ³„ μˆœμ„œ 적용
  • order의 κΈ°λ³Έ 값은 0이며, μ–‘μˆ˜λ‚˜ 음수둜 λ°”κΏ€ 수 μžˆλ‹€
  • μ˜ˆμ‹œ
#pond {
  display: flex;
}

.yellow {
  order: 1; /* λ…Έλž€ 개ꡬ리의 μˆœμ„œλ₯Ό λ’€λ‘œ λ°”κΎΌλ‹€ */
}


  • μ˜ˆμ‹œ2
#pond {
  display: flex;
}

.red {
  order: -1;
}



β—‹ align-self

  • κ°œλ³„ μš”μ†Œμ— μ μš©ν•˜λŠ” 속성
  • align-items(μ„Έλ‘œ μ •λ ¬)의 κ°’λ“€λ‘œ μ§€μ •ν•œλ‹€

    • flex-start μš”μ†Œλ“€μ„ μ»¨ν…Œμ΄λ„ˆμ˜ κΌ­λŒ€κΈ°λ‘œ μ •λ ¬.
    • flex-end μš”μ†Œλ“€μ„ μ»¨ν…Œμ΄λ„ˆμ˜ λ°”λ‹₯으둜 μ •λ ¬.
    • center μš”μ†Œλ“€μ„ μ»¨ν…Œμ΄λ„ˆμ˜ μ„Έλ‘œμ„  μƒμ˜ κ°€μš΄λ°λ‘œ μ •λ ¬.
    • baseline μš”μ†Œλ“€μ„ μ»¨ν…Œμ΄λ„ˆμ˜ μ‹œμž‘ μœ„μΉ˜μ— μ •λ ¬.
    • stretch μš”μ†Œλ“€μ„ μ»¨ν…Œμ΄λ„ˆμ— λ§žλ„λ‘ λŠ˜λ¦°λ‹€.
  • μ˜ˆμ‹œ
#pond {
  display: flex;
  align-items: flex-start;
}

.yellow {
  align-self: flex-end;
}


●border+align-self

FROGGY 단계 17

#pond {
  display: flex;
  align-items: flex-start;
}

.yellow {
  order: 1;
  align-self: flex-end;
}



β—‹ flex-wrap

  • 쀄 λ°”κΏˆ
  • 3개의 κ°’μœΌλ‘œ 지정할 수 μžˆλ‹€

    • nowrap λͺ¨λ“  μš”μ†Œλ“€μ„ ν•œ 쀄에 μ •λ ¬.
    • `wrap μš”μ†Œλ“€μ„ μ—¬λŸ¬ 쀄에 걸쳐 μ •λ ¬.
    • `wrap-reverse μš”μ†Œλ“€μ„ μ—¬λŸ¬ 쀄에 걸쳐 λ°˜λŒ€λ‘œ μ •λ ¬.
  • μ˜ˆμ‹œ
#pond {
  display: flex;
  flex-wrap: wrap;
}


●bflex-direction+flex-wrap

FROGGY 단계 19

#pond {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
}



β—‹ flex-flow

  • flex-direction+flex-wrap
  • μ˜ˆμ‹œ
#pond {
  display: flex;
  flex-flow: column wrap;
}



β—‹ align-content

  • μ—¬λŸ¬ 쀄 μ‚¬μ΄μ˜ 간격을 지정
  • 5개의 κ°’μœΌλ‘œ 지정할 수 μžˆλ‹€
    • flex-start μ—¬λŸ¬ 쀄듀을 μ»¨ν…Œμ΄λ„ˆμ˜ κΌ­λŒ€κΈ°μ— μ •λ ¬.
    • flex-end μ—¬λŸ¬ 쀄듀을 μ»¨ν…Œμ΄λ„ˆμ˜ λ°”λ‹₯에 μ •λ ¬.
    • center μ—¬λŸ¬ 쀄듀을 μ„Έλ‘œμ„  μƒμ˜ κ°€μš΄λ°μ— μ •λ ¬.
    • space-between μ—¬λŸ¬ 쀄듀 사이에 λ™μΌν•œ 간격을 λ‘”λ‹€.
    • space-around μ—¬λŸ¬ 쀄듀 μ£Όμœ„μ— λ™μΌν•œ 간격을 λ‘”λ‹€.
    • stretch μ—¬λŸ¬ 쀄듀을 μ»¨ν…Œμ΄λ„ˆμ— λ§žλ„λ‘ λŠ˜λ¦°λ‹€.
  • πŸš©μ§‘μ€‘! align-contentλŠ” μ—¬λŸ¬ 쀄듀 μ‚¬μ΄μ˜ 간격을 μ§€μ •ν•˜λ©°, align-itemsλŠ” μ»¨ν…Œμ΄λ„ˆ μ•ˆμ—μ„œ μ–΄λ–»κ²Œ λͺ¨λ“  μš”μ†Œλ“€μ΄ μ •λ ¬ν•˜λŠ”μ§€λ₯Ό μ§€μ •ν•œλ‹€.
  • ν•œ μ€„λ§Œ μžˆλŠ” 경우, align-contentλŠ” 효과λ₯Ό 보이지 μ•ŠλŠ”λ‹€

  • μ˜ˆμ‹œ
#pond {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-end;
}


● flex-direction+align-content

FROGGY 단계 23

#pond {
  display: flex;
  flex-wrap: wrap;
  flex-direction: column-reverse;
  align-content: center;
}


● FROGGY 단계 24

#pond {
  display: flex;
  flex-flow: column-reverse wrap-reverse;
  justify-content: center;
  align-content: space-between;
}