Centered fixed width layout with 100% padding on one side only - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Layout

Description

Centered fixed width layout with 100% padding on one side only

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%
}

div {<!--from w ww.j a  v  a  2 s  . c o  m-->
   width:51%;
   height:100%;
   background-color:Chartreuse;
}

div div {
   width:100px;
   float:right;
   margin-right:-51px;
   outline:2px solid blue;
}
</style> 
 </head> 
 <body> 
  <div> 
   <div></div> 
  </div>  
 </body>
</html>

Related Tutorials