• 회원가입
  • 로그인
  • 구글아이디로 로그인

[flex] CSS - flex-grow 속성(I) ★ - 아이템 너비 증가 (= flex-grow속성 = 플렉스그로속성, IE11) ※ 플렉스 아이템용 속성

목차
  1. flex-grow 예제 - 아이템 너비 증가
  2. flex-grow 정의
  3. flex-grow 구문
  4. flex-grow 관련 주소

 

flex-grow 예제 - 아이템 너비 증가

 

<style>

#hz {

  width: 350px;

  height: 100px;

  border: 1px solid silver;

  display: -webkit-flex; /* Safari */

  display: flex;

}


/* Safari 6.1+ */

#hz div:nth-of-type(1) {-webkit-flex-grow: 1;}

#hz div:nth-of-type(2) {-webkit-flex-grow: 3;}

#hz div:nth-of-type(3) {-webkit-flex-grow: 1;}

#hz div:nth-of-type(4) {-webkit-flex-grow: 1;}

#hz div:nth-of-type(5) {-webkit-flex-grow: 1;}


/* 표준 구문 */

#hz div:nth-of-type(1) {flex-grow: 1;}

#hz div:nth-of-type(2) {flex-grow: 3;}

#hz div:nth-of-type(3) {flex-grow: 1;}

#hz div:nth-of-type(4) {flex-grow: 1;}

#hz div:nth-of-type(5) {flex-grow: 1;}

</style>


<div id="hz">

  <div style="background-color:coral;"></div>

  <div style="background-color:lightblue;"></div>

  <div style="background-color:khaki;"></div>

  <div style="background-color:pink;"></div>

  <div style="background-color:lightgrey;"></div>

</div>

 

결과보기

 

flex-grow 정의

 

컨테이너 안 나머지 아이템에 비해 얼마나 커질지 지정.

(= 여백 너비를 각 아이템에 어떻게 배분할지를 지정.)

 


 

1.

요소가 플렉스 아이템 아닌 경우, 적용 안 됨.

 

2.

  • 기본값: 0
  • 상속여부: X
  • 애니효과: O
  • CSS버전: CSS3
  • JS구문: object.style.flexGrow="5";

 

3.

  • IE 11 이상, 주요 최신 브라우저 지원.
  • 일부 구형 브라우저는 브라우저접두어 필요.

 

 

flex-grow 구문

 

selector {flex-grow: number|initial|inherit;}

 


[속성값]

 

number

다른 아이템에 비해 얼마나 커질지 지정. (기본값: 0)

 

initial

이 속성의 기본값으로 설정.

 

inherit

부모요소 속성값 상속.

 

 

flex-grow 관련 주소

 

mdn flex-grow 강의

https://developer.mozilla.org/en-US/docs/Web/CSS/flex-grow (영어)

https://developer.mozilla.org/ko/docs/Web/CSS/flex-grow (한국어)

 


 


분류 제목
selector CSS - :nth-of-type(n) 가상선택자 - 지정타입n번째 자식요소 (순서선택자,타입선택자, IE9…
selector CSS - :only-of-type 가상선택자 - 타입유일 자식요소 (= 유일타입 자식요소) [유일선택자|타…
selector CSS - :only-child 가상선택자 - 그 부모의 유일자식요소 (유일선택자, IE9)
selector CSS - :optional 가상선택자 - 선택입력요소 (= required 속성없는 요소, IE10)
selector CSS - :out-of-range 가상선택자 - 지정범위밖값 갖는 요소 선택 (=아웃어브레인지선택자, IE…
selector CSS - :read-only 가상선택자 - 읽기전용요소 (= readonly속성있는요소 = :read-on…
selector CSS - :read-write 가상선택자 - 읽고쓰기가능요소 (= readonly속성없는요소, IE13)
selector CSS - :required 가상선택자 - 필수입력요소 (= required속성있는요소, IE10)
selector CSS - :root 가상선택자 - 웹문서root요소 선택. (= 루트선택자, IE9)
selector CSS - :target 가상선택자 - 내부링크목적지요소 (= :target선택자 = 타겟선택자 = 목적지선…
selector CSS - :valid 가상선택자 - 유효요소 (= 유효값 갖는 요소 선택, IE10)
selector CSS - ::selection 가상선택자 - 사용자가 선택한 영역 (= ::selection선택자) (가상…
selector CSS - .class 클래스선택자 ★
selector CSS - .class1.class2 클래스선택자 ★★★ - 두 클래스가 (모두/함게/둘다/동시) 정의된 요…
selector CSS - .class1 .class2 클래스선택자 ★★ - class1자손 중 class2 갖는 모든 요소
flex CSS - flex 속성(I) ☆ - flex-grow, flex-shrink, flex-basis 속성 일…
flex CSS - flex-basis 속성(I) ★ - 아이템 초기 길이 (= 아이템너비 = flex-basis속성…
flex CSS - flex-grow 속성(I) ★ - 아이템 너비 증가 (= flex-grow속성 = 플렉스그로속성…
flex CSS - flex-shrink 속성(I) ★ - 동일컨테이너 안 나머지 플렉스아이템에 비해 얼마나 줄어들지…
css CSS - FADE-IN TEXT - 페이드인 텍스트 (= 서서히 사라지는 이미지 + 서서히 나타나는 글자)
14/25
목록
찾아주셔서 감사합니다. Since 2012