Extra space on bottom of <div> with responsive background image - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

Extra space on bottom of <div> with responsive background image

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>Lorem ip</title> 
  <style type="text/css">
html, body {
   padding:0;
   margin:0;
   width:100%;
   height:100%;
   text-align:center;
}

#Container {<!--  ww w . j  a v a 2s  .c  o  m-->
   text-align:center;
   height:100vh;
   width:100vh;
   position:relative;
   display:inline-block;
}

#Header {
   background:url('https://www.java2s.com/style/demo/Google-Chrome.png');
   min-height:209px;
   position:absolute;
   left:0px;
   top:0px;
   z-index:3;
}

#Body {
   background:url('https://www.java2s.com/style/demo/Google-Chrome.png');
   max-width:601px;
   min-height:51px;
   width:100%;
   float:left;
   clear:both;
   position:absolute;
   left:0px;
   top:0px;
   bottom:0px;
   z-index:0;
}

#Footer {
   background:url('https://www.java2s.com/style/demo/Google-Chrome.png');
   min-height:381px;
   position:absolute;
   bottom:0;
   left:0;
   z-index:2;
}

#Header, #Footer {
   background-repeat:no-repeat;
   background-size:contain;
   background-clip:border-box;
   width:100%;
   float:left;
   clear:both;
   margin:0;
}
</style> 
 </head> 
 <body> 
  <div id="Container"> 
   <div id="Header"></div> 
   <div id="Body"></div> 
   <div id="Footer"></div> 
  </div>  
 </body>
</html>

Related Tutorials