Fixed child to bottom - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Fixed Position

Description

Fixed child to bottom

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">
* {<!--  w w w.j  a  v  a  2  s .c  om-->
   margin:0;
   padding:0;
   border:0;
   -webkit-box-sizing:border-box;
   -moz-box-sizing:border-box;
   box-sizing:border-box;
}

#main {
   position:relative;
   background:Chartreuse;
   margin-bottom:71px;
   height:801px;
   overflow:hidden;
   z-index:11;
   background:url('https://www.java2s.com/style/demo/Google-Chrome.png') center center no-repeat;
   background-size:cover;
   background-attachment:fixed;
}

#footer {
   position:relative;
}

#footer-inner {
   position:fixed;
   background:yellow;
   bottom:0;
   width:100%;
   height:71px;
   z-index:0;
}
</style> 
 </head> 
 <body> 
  <div id="main"> 
   <div id="main-content"></div> 
  </div> 
  <div id="footer"> 
   <div id="footer-inner"></div> 
  </div>  
 </body>
</html>

Related Tutorials