Getting a 100% height div inside a flexbox item, two column layout with header and footer - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Column

Description

Getting a 100% height div inside a flexbox item, two column layout with header and footer

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">

.wrapper, html, body {
   height: 100%;
   margin: 0;
   padding:0;
}

#topRow {<!--from  w  ww .  j a v  a2s  .  c  om-->
   background-color: black;
   color: white;
   height:20%;
}
#bottomRow {
   background-color: #333333;
   color: white;
   height:10%;
}
#centralRow {
   height:70%;
   display: flex;
}
#sidebarColumn {
   background-color: #B83B1D;
   color: white;
   width:20%;
   display: flex;
   flex-direction: column;
}
#sidebarColumn nav {
   padding:1em;
   border:1px solid yellow;
   flex:1;
}
#contentColumn {
   overflow: auto;
   flex:1;
}
.big {
   border:1px solid red;
   margin:1em;
   height:400px;
}


      </style> 
 </head> 
 <body> 
  <div class="wrapper"> 
   <div id="topRow">
     header 
   </div> 
   <div id="centralRow"> 
    <div id="sidebarColumn">
      sidebar 
     <nav>
       nav links 
     </nav> 
    </div> 
    <div id="contentColumn">
      body content 
     <div class="big">
       some big content 
     </div> 
    </div> 
   </div> 
   <div id="bottomRow">
     footer 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials