Centre a Page Layout With HTML/CSS - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Layout

Description

Centre a Page Layout With HTML/CSS

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">
body {<!--  ww w .j av  a2 s  .  c o  m-->
   width:961px;
   margin:0 auto;
}

header {
   text-align:center;
   width:961px;
}

nav {
   line-height:31px;
   float:left;
   padding:6px;
   height:100px;
   width:191px;
}

section {
   float:left;
   padding:6px;
   width:741px;
}

footer {
   background-color:Chartreuse;
   text-align:center;
   padding:6px;
   width:961px;
   clear:both;
}
</style> 
 </head> 
 <body> 
  <header> 
   <h1>Lorem i</h1> 
  </header> 
  <nav> 
   <ul> 
    <li> <a href="#">Lorem </a> </li> 
    <li> <a href="#">Lorem </a> </li> 
    <li> <a href="#">Lorem </a> </li> 
   </ul> 
  </nav> 
  <section> 
   <h2>Lorem i</h2> 
   <p>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 in, p</p> 
  </section> 
  <footer>
    Lorem ipsum dolo 
  </footer>  
 </body>
</html>

Related Tutorials