css - How to get flexbox align-items flex-end to work in WebKit/Blink? -


i'm trying nest flexbox in flexbox. outer box vertical:

+------+ |      | +------+ |      | |      | |      | +------+ 

where top area fits content flex 0 1 auto , bottom half fills remaining space flex 1 1 auto.

in bottom half have flex-box going horizontal. want 2 inner boxes space-between across , flex-end align-items 2 inners pinned left , right bottom corners this:

+------+ |      | +-+  +-| |l|  |r| +------+ 

setting seems work in firefox in chrome(blink) , safari this:

+------+ |      | |      | |      | +-+--+-| |l|  |r| +-+  +-+ 

here's html

<div id="outer">     <div id="top">         top     </div>     <div id="bottom">         <div id="bottomcontents">             <div id="botleft">                 bottom left             </div>             <div id="botright">                 bottom right             </div>         </div>     </div> </div> 

and there's css

* {     box-sizing: border-box;     -moz-box-sizing: border-box;    }  html, body {     width: 100%;     height: 100%;     margin: 0px;     padding: 0px;     border: 0px; }  #outer {     height: 100%;     border: 1px solid red;     display: flex;     display: -webkit-flex;     flex-flow: column;     -webkit-flex-flow: column;     justify-content: center;     align-content: center;     align-items: center;     -webkit-justify-content: center;     -webkit-align-content: center;     -webkit-align-items: center;     min-height: auto;     } #top {     width: 100%;     flex: 0 1 auto;     -webkit-flex: 0 1 auto;     border: 1px solid blue; } #bottom {     width: 100%;     height: 100%;     flex: 1 1 auto;     -webkit-flex: 1 1 auto;     border: 1px solid green; } #bottomcontents {     height: 100%;     width: 100%;     border: 1px solid pink;     display: flex;     display: -webkit-flex;     flex-flow: row;     -webkit-flex-flow: row;     justify-content: space-between;     align-content: center;     align-items: flex-end;     -webkit-justify-content: space-between;     -webkit-align-content: center;     -webkit-align-items: flex-end;     min-height: auto;         }  #botleft, #botright {     flex: 0 1 auto;     -webkit-flex: 0 1 auto; } #botleft {     border: 1px solid purple; } #botright {     border: 1px solid cyan; } 

and here's fiddle

it works expected in firefox. did wrong? bug in chrome , safari? there workaround?

basicaly, you're seeing "height: 100%;" on #bottomcontents forcing container "outside" of surrounding container. 100% height ends getting height parent, has 100% height; meaning height being specified #bottomcontents being set same height #outer. can see little more it's going beyond should if add "overflow: hidden;" #bottom. more in-depth discussion of issue can found here: you're running covered here: height 100% on flexbox column child

unless missing requirement you're needing, can remove #bottomcontents container , make due #bottom. example code (jsfiddle example @ bottom):

html:

<div id="outer">     <div id="top">         top     </div>     <div id="bottom">         <div id="bottomcontents">             <div id="botleft">                 bottom left             </div>             <div id="botright">                 bottom right             </div>         </div>     </div> </div> 

css:

* {     box-sizing: border-box;     -moz-box-sizing: border-box;    }  html, body {     width: 100%;     height: 100%;     margin: 0px;     padding: 0px;     border: 0px; }  #outer {     border: 5px solid red;     display: flex;     display: -webkit-flex;     height: 100%;     width: 100%;     flex-direction: column;     -webkit-flex-direction: column; }  #top {     width: 100%;     border: 5px solid blue;     flex: 0 1 auto;     -webkit-flex: 0 1 auto; }  #bottom {     width: 100%;     display: flex;     display: -webkit-flex;     flex-direction: row;     -webkit-flex-direction: row;     justify-content: space-between;     -webkit-justify-content: space-between;     height: 100%;     border: 5px solid green;     align-items: flex-end;     -webkit-align-items: flex-end; }  #left {     border: 5px solid purple;     padding: .5em;     flex: 0 1 auto;     -webkit-flex: 0 1 auto; }  #right {     border: 5px solid cyan;     padding: .5em;     flex: 0 1 auto;     -webkit-flex: 0 1 auto; } 

my fiddle: http://jsfiddle.net/blake770/2br5x/


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -