width 100%를 하려면 flex grow를 사용해보자
본문 바로가기

Frontend/css

width 100%를 하려면 flex grow를 사용해보자

만약 공간안에 box1, box2, box3을 꽉채우려면? 그러나 box1과 box3을 일정 px너비가 주어져있다.

box2에 ~80%의 width값을 줄경우 해결이 되기도하지만 만약 버튼이 많아지거나 크기가 바뀔경우 계속 width값을 조절해야할것이다.

만약 공간이 flex로 되어있을경우 flex-grow:2를 넣어 해결할수있다.

https://css-tricks.com/snippets/css/a-guide-to-flexbox/#flex-grow

관련문서

 

A Complete Guide to Flexbox

Our comprehensive guide to CSS flexbox layout. This complete guide explains everything about flexbox, focusing on all the different possible properties for the parent element (the flex container) and the child elements (the flex items). It also includes hi

css-tricks.com

 

반응형

'Frontend > css' 카테고리의 다른 글

css 명세 읽는법 value  (0) 2022.03.06
table colspan rowspan 예시  (0) 2021.09.08
inline과 block  (0) 2021.05.19
익숙하지않은 css 리스트  (0) 2021.05.17
유투프 풀사이트 iframe  (0) 2020.10.29