Nested div with height 100% with sticky footer for single column layout - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Footer stick to bottom

Description

Nested div with height 100% with sticky footer for single column layout

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 html {
   display:block;
   margin:0;
   padding:0;
}

body {<!-- w  w  w . ja  v  a  2 s.  c o  m-->
   width:941px;
   margin:0 auto;
}

.supercontainer {
   background-color:Chartreuse;
   margin:0 auto;
   width:941px;
}

.nav {
   background-color:yellow;
   height:51px
}

img {
   float:left;
   margin:26px 31px;
}

.wrapper {
   background-color:blue;
   border-left:3px solid pink;
   border-right:3px solid OrangeRed;
   height:100%;
   margin:0 auto 100px auto;
   width:941px;
}

.footer {
   background:none repeat scroll 0 0 grey;
   bottom:0;
   height:100px;
   position:fixed;
   width:941px;
}
</style> 
 </head> 
 <body> 
  <div class="supercontainer"> 
   <div class="nav"></div> 
   <div class="wrapper">
     Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat volutpat. Vestibulum tortor neque, ornare vitae tempor hendrerit, luctus at neque. Phasellus sed quam pharetra, tincidunt tortor in, pharetra nisl. Maecenas aliquam luctus mauris, vitae ve 
    <br> 
    <br>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat volutpat. Vestibulum tortor neque, ornare vitae tempor hendrerit, luctus at neque. Phasellus sed quam pharetra, tincidunt tortor in, pharetra nisl. Maecenas aliquam luctus mauris, vitae venenatis diam imperdiet vel. Donec tortor diam, pretium vitae nibh vitae, consectetur lacinia sem. Proin luctus facilisis volutpat. Ut semper sit amet pur 
    <br> 
    <br> 
    <img src="https://www.java2s.com/style/demo/Google-Chrome.png"> 
    <img src="https://www.java2s.com/style/demo/Safari.png"> 
    <br> 
    <br>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat volutpat. Vestibulum tortor neque, ornare vitae tempor hendrerit, luctus at neque. Phasellus sed quam pharetra, tincidunt tortor in, pharetra nisl. Maecenas aliquam luctus mauris, vitae venenatis diam imperdiet vel. Donec tortor diam, pretium vitae nibh vitae, consectetur lacinia sem. Proin luctus facilisis volutpat. Ut semper sit a 
    <br> 
    <br> 
   </div> 
  </div> 
  <div class="footer"></div>  
 </body>
</html>

Related Tutorials