CSS position absolute content area - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Absolute Position

Description

CSS position absolute content area

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 {
   height:100%;
}

body {<!--from w w w .  j  a va 2 s  .  c om-->
   height:100%;
   margin:0px;
}

#wrap {
   width:100%;
   height:100%;
   margin:0 auto;
}

#header {
   width:100%;
   height:51px;
   background:blue;
}

#footer {
   width:100%;
   height:51px;
   background:green;
   position:relative;
   margin-top:-31px;
}

#content {
   background:Chartreuse;
   width:451px;
   height:100%;
   display:table;
   margin:auto;
   padding:11px;
   position:relative;
   z-index:21;
   top:-16px;
   box-shadow:0px 0px 4px yellow;
}
</style> 
 </head> 
 <body> 
  <div id="wrap"> 
   <div id="header">
     Lorem ip 
   </div> 
   <div id="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 
   </div> 
   <div id="footer">
     Lorem ip 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials