Stretch div between header and footer - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Footer

Description

Stretch div between 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">
html, body, body>div {
   margin:0;
   height:100%;
}

body {<!--  w  w  w  .ja  v a 2s . c  o m-->
   background-color:Chartreuse;
}

body>div {
   display:table;
   width:100%;
}

body>div>* {
   display:table-row;
}

body>div>*>div {
   display:table-cell;
   vertical-align:middle;
   border:2px solid yellow;
}

header, footer {
   height:2px;
}
</style> 
 </head> 
 <body> 
  <div> 
   <header> 
    <div>
      Lorem 
    </div> 
   </header> 
   <main> 
    <div> 
     <div class="content"></div> 
    </div> 
   </main> 
   <footer> 
    <div>
      Lorem 
    </div> 
   </footer> 
  </div>  
 </body>
</html>

Related Tutorials