Responsive 2-column CSS layout including sidebar with fixed width - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

Responsive 2-column CSS layout including sidebar with fixed width

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <style>
body {<!--from w w  w.ja  va2  s  . co  m-->
   background:orange;
}

#container {
   max-width:1001px;
   min-width:769px;
   margin:0 auto;
   background:yellow;
   position:relative;
   height:100%;
}

#header {
   background:purple;
   color:Chartreuse;
   text-align:center;
   padding:11px;
}

#main {
   display:table;
   width:100%;
}

aside {
   background:blue;
   width:201px;
   color:yellow;
   display:table-cell;
}

#primary {
   background:red;
   display:table-cell;
}

#footer {
   background:green;
   color:blue;
   padding:11px;
}
</style> 
 </head> 
 <body> 
  <div id="container"> 
   <div id="header"> 
    <h1>Lorem ipsum do</h1> 
   </div> 
   <div id="main"> 
    <aside> 
     <h3>Lorem ipsum dolor</h3> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
    </aside> 
    <div id="primary"> 
     <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper moles</h2> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <h2>Lorem ipsum</h2> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <h2>Lorem ipsum</h2> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
     <p>Lorem ipsum</p> 
    </div> 
   </div> 
   <div id="footer"> 
    <h1>Lorem ipsum do</h1> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials