CSS positioning and clearfix - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

CSS positioning and clearfix

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">
* {<!--  ww w .ja v  a2s  .c  o m-->
   margin-left:auto;
   margin-right:auto;
   background:white;
}

body {
   background:grey;
   padding:0;
   margin:0;
}

header {
   width:901px;
   height:151px;
   border:2px solid Chartreuse;
}

#pageWrapper {
   position:relative;
   width:851px;
   height:601px;
   top:0px;
   border:2px solid yellow;
}

#page {
   position:absolute;
   top:26px;
   left:26px;
   border:2px solid blue;
   height:551px;
   width:801px;
}
</style> 
 </head> 
 <body> 
  <header>
    Lor 
  </header> 
  <div id="pageWrapper"> 
   <div id="page"></div> 
  </div> 
  <!--<footer></footer>-->  
 </body>
</html>

Related Tutorials