Place a floating footer to stick to the bottom of the viewport - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Footer aligned bottom

Description

Place a floating footer to stick to the bottom of the viewport

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <style>
.content<!--   w w w . j av a  2s .  c  o  m-->
 {
   position:absolute;
   top:0;
   left:0;
   right:0;
   bottom:51px;
   overflow:auto;
   background-color:Chartreuse;
}

.footer
 {
   position:absolute;
   left:0;
   right:0;
   bottom:0px;
   height:51px;
   overflow:hidden;
   background-color:yellow;
}
</style> 
 </head> 
 <body> 
  <div class="content">
    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 purus quis ornare. Quisque lobortis neque vitae tempor iaculis. Aliqua 
  </div> 
  <div class="footer">
    Lorem ipsum 
  </div>  
 </body>
</html>

Related Tutorials