Aligning footer with the sidebar - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Footer

Description

Aligning footer with the sidebar

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">
.contain {<!--from   ww w. j  av  a  2  s  .  c  o  m-->
   width:100%;
   height:100%;
   border-bottom:2px solid Chartreuse;
}

.sidebar {
   float:right;
   background:yellow;
   color:blue;
   height:301px;
}

.clear {
   clear:both;
}

.footer {
   position:relative;
   height:21px;
   width:201px;
   background:red;
   margin-top:-21px;
}
</style> 
 </head> 
 <body> 
  <div class="contain"> 
   <div class="sidebar">
     Hi I'm a sidebar. 
   </div> 
   <div class="content">
     Blah blah blah. 
   </div> 
   <div class="clear"></div> 
   <div class="footer">
     I'm on the bottom. 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials