갈푸라떼
갈푸라떼는 개발중
갈푸라떼
전체 방문자
오늘
어제
  • 분류 전체보기 (232)
    • CS (0)
      • CSinfo (0)
    • Frontend (15)
      • HTML,CSS (1)
      • Javascript (2)
      • React (0)
      • React Hook (12)
    • Backend (0)
      • Python (0)
      • Node.js (0)
      • php (0)
    • DB (2)
      • MySQL (2)
      • BigQuery (0)
      • Mongodb (0)
    • Study (186)
      • JavaScript (72)
      • JavaScript(Clean code) (50)
      • Node.js (11)
      • HTML,CSS (13)
      • React (30)
      • TypeScript (10)
      • React-Native (0)
    • Error (2)
      • error (2)
    • Git (22)
      • Git (22)
    • Help Coding (4)
      • Useful websites (3)

블로그 메뉴

  • 홈
  • 태그
  • 방명록
  • Github

공지사항

인기 글

태그

  • 인터프리터
  • 정적 레벨
  • 심볼
  • prototype
  • 렉시컬 환경
  • 스코프 체인
  • 자바스크립트엔진
  • 컴파일러
  • SPREAD
  • Arrow
  • 함수
  • 이터러블
  • PM2
  • 실행 컨텍스트
  • function
  • ECMAScript
  • class
  • 원시타입
  • 오버라이딩
  • 상속
  • 객체타입
  • symbol
  • 프로토타입
  • nodemon
  • Babel
  • 호이스팅
  • 싱글스레드
  • 네이밍
  • this
  • structure

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
갈푸라떼

갈푸라떼는 개발중

[CSS_study] flex-wrap, align-content, flex-flow
Study/HTML,CSS

[CSS_study] flex-wrap, align-content, flex-flow

2022. 5. 13. 01:54

* flex-wrap

  • flexbox는 width보다도, '같은 줄'에 있도록 하는 것을 우선시함
    • width의 크기를 깨트려서라도 오직 같은 줄에 있도록 만드는 데만 신경을 쓴다.
    • flex-wrap의 기본값은 nowrap이다.
  • flex-wrap: wrap; (child의 사이즈를 유지하라고 하는 것)
  • flex-wrap: nowrap; (child를 모두 같은 줄에 정렬함, 이때 width가 줄어들 수 있음)

* flex-wrap 예시코드

* flex-wrap: nowrap

<div class="father">
  <div class="child">1</div>
  <div class="child">2</div>
  <div class="child">3</div>
  <div class="child">4</div>
  <div class="child">5</div>
  <div class="child">6</div>
  <div class="child">7</div>
</div>

 

 

.father {
  display: flex;
  justify-content: space-around;
  height: 100vh;
}

.child {
  width: 200px;
  height: 200px;
  background: peru;
  color: white;
  flex-wrap: nowrap
}


* flex-wrap: nowrap

.father {
  display: flex;
  justify-content: space-around;
  height: 100vh;
}

.child {
  width: 200px;
  height: 200px;
  background: peru;
  color: white;
  flex-wrap: wrap
}


* reverse

  • flex-direction: row-reverse; (오른쪽에서부터 1이 시작)
    • column-reverse도 가능
  • flex-wrap: wrap-reverse; (한 줄이 되지 않아도 아래에서 위로 정렬되게)


* align-content (line을 변경, line은 cross-axis에 있는 상태)

  • wrap으로 정렬 시 (여러 줄로, 각 item의 width를 유지)
  • 각 줄(기본: row) 간의 간격이 생기는데, 이것을 'align-content'라는 property로 조절 가능
  • justify-content와 비슷하지만 'line'에 관한 것
    • (아이템들의 가로폭의 합이 콘테이너의 가로폭을 넘어가면 아이템이 다음 줄로 내려갑니다. 이때 여러 줄이 되어버린 아이템들의 정렬을 어떻게 할지 정하는 속성)

* align-content 예시코드

.father {
  display: flex;
  justify-content: space-around;
  align-content: flex-start;
  height: 100vh;
}

.child {
  width: 200px;
  height: 200px;
  background: peru;
  color: white;
  flex-wrap: wrap
}


* flex-flow

 flex-flow는 flex-direction속성과 flex-wrap의 속성을 합쳐서 앞쪽은 flex-direction설정 뒤쪽은 flex-wrap를 설정하는 것이다.

(개인적으로 잘 사용하지 않음)

 

* flex-flow 예시코드

flex-flow: row nowrap;
flex-flow: column wrap;
flex-flow: column-reverse wrap-reverse;

'Study > HTML,CSS' 카테고리의 다른 글

[CSS_study] display : grid  (0) 2022.05.13
[CSS_study] flex-basis (flex-shrink 와 flex-grow 를 위한 기본 세팅)  (0) 2022.05.13
[CSS_study] flex-grow, flex-shrink  (0) 2022.05.13
[CSS_study] display : flex 그리고align-self와 order  (0) 2022.05.12
[CSS_study] display : block, inline, inline-block  (0) 2022.05.12
    'Study/HTML,CSS' 카테고리의 다른 글
    • [CSS_study] flex-basis (flex-shrink 와 flex-grow 를 위한 기본 세팅)
    • [CSS_study] flex-grow, flex-shrink
    • [CSS_study] display : flex 그리고align-self와 order
    • [CSS_study] display : block, inline, inline-block
    갈푸라떼
    갈푸라떼

    티스토리툴바