Make flexbox stretching height of element - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Height

Description

Make flexbox stretching height of element

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
#page-wrapper {<!-- w  ww.  j  av  a2 s.  c  om-->
   display:flex;
   flex-flow:column wrap;
   height:100vh;
}

#left-panel {
   background:Chartreuse;
   min-height:100%;
   width:151px;
   order:-2;
   flex:0 0 auto;
}

#banner, #footer, #content {
   width:calc(100% - 151px);
}

#banner {
   background:yellow;
   height:41px;
}

#footer {
   background:blue;
   height:26px;
}

#content {
   background:pink;
   flex:2 2 auto;
}

body {
   margin:0;
}
</style> 
 </head> 
 <body> 
  <div id="page-wrapper"> 
   <div id="banner">
     banner 
   </div> 
   <div id="left-panel">
     left-panel 
   </div> 
   <div id="content">
     content 
   </div> 
   <div id="footer">
     footer 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials