html - Equally distributing height with CSS -


i have html problem pretty tricky , i'm not sure there css-based solution it. have 3 column grid. first , third columns can contain variable number of rows in them. second column has 1 row. each row has minimum height.

so column rows have rows height set minimum height. rows in other columns should expand equally in height take remaining space.

say column 1 has 3 rows, each 50px tall. column 2 must have 1 row 150px tall. if column 3 has 2 rows must each 75px tall. below pictures further illustrate i'm after.

is possible css?

enter image description here

if don't mind working in small handful of browsers, can absolutely pure css. go ahead, add , remove many grandchild divs want:

http://codepen.io/cimmanon/pen/ldmtj

/* line 5, ../sass/test.scss */ .wrapper {   display: -webkit-flexbox;   display: -ms-flexbox;   display: -webkit-flex; } @supports (display: flex) , (flex-wrap: wrap) {   /* line 5, ../sass/test.scss */   .wrapper {     display: flex;   } }  /* line 9, ../sass/test.scss */ .a, .b, .c {   display: -webkit-flexbox;   display: -ms-flexbox;   display: -webkit-flex;   -webkit-flex-flow: row wrap;   -ms-flex-flow: row wrap;   flex-flow: row wrap; } @supports (display: flex) , (flex-wrap: wrap) {   /* line 9, ../sass/test.scss */   .a, .b, .c {     display: flex;   } } /* line 13, ../sass/test.scss */ .a div, .b div, .c div {   border: 1px solid;   -webkit-flex: 1 0 100%;   -ms-flex: 1 0 100%;   flex: 1 0 100%; }  /* fancy up! */ /* line 21, ../sass/test.scss */ .a {   background: #ff9999;   -webkit-flex: 1 1 10em;   -ms-flex: 1 1 10em;   flex: 1 1 10em; }  /* line 26, ../sass/test.scss */ .b {   background: #00e600;   -webkit-flex: 1 1 10em;   -ms-flex: 1 1 10em;   flex: 1 1 10em; }  /* line 31, ../sass/test.scss */ .c {   background: #9999ff;   -webkit-flex: 1 1 40%;   -ms-flex: 1 1 40%;   flex: 1 1 40%; }  <div class="wrapper">   <div class="a">     <div>a</div>     <div>a</div>     <div>a</div>     <div>a</div>     <div>a</div>   </div>    <div class="b">     <div>b</div>   </div>    <div class="c">     <div>c</div>     <div>c</div>   </div> </div> 

browser support: opera, chrome, ie10. when firefox gets around finishing supporting current flexbox draft including flex-wrap, work there well.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -