CSS layout with fixed top and bottom, variable height middle - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Layout

Description

CSS layout with fixed top and bottom, variable height middle

Demo Code

ResultView the demo in separate window

<!doctype html>

<html lang="en">
 <head> 
  <title>Lorem ip</title> 
 </head> <!--from   www. j  av  a 2s .co  m-->
 <body> 
  <style>
html, body {
   top:0;
   width:100%;
   height:100%;
   margin:0;
   padding:0;
}

.top {
   position:fixed;
   top:0;
   width:100%;
   height:100px;
   background:yellow;
}

.bottom {
   position:fixed;
   bottom:0;
   width:100%;
   height:100px;
   background:grey;
}

.middle {
   padding-top:100px;
   padding-bottom:100px
}
</style> 
  <div class="container"> 
   <div class="top">
     Lorem 
   </div> 
   <div class="middle">
     Lorem i 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem ip 
    <br>Lorem 
   </div> 
   <div class="bottom">
     Lorem ip 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials