position a div in accordance to another div's margin - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

position a div in accordance to another div's margin

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">
.header {<!-- w  w w .ja v  a2s  .  c  o  m-->
   width:100%;
   height:100px;
   position:fixed;
   top:0;
   background-color:Chartreuse;
}

.container {
   margin:0 auto;
   margin-top:100px;
   margin-bottom:100px;
}
</style> 
 </head> 
 <body> 
  <div class="header"></div> 
  <div class="container"> 
   <p>Lorem ipsum dolor sit </p> 
  </div>  
 </body>
</html>

Related Tutorials