Create 2 fixed width columns and fluid content area - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:2 Column

Description

Create 2 fixed width columns and fluid content area

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">
*
 {
   margin:0;
   padding:0;
}

html,body
 {
   width:100%;
   height:100%;
   background:Chartreuse;
}

.main<!--   w  w w. j  a  v  a 2  s .c o m-->
 {
   box-sizing:border-box;
}

#leftSidebar {
   width:81px;
   position:fixed;
   float:left;
   top:0px;
   bottom:0px;
   left:0px;
   margin:5px;
   box-sizing:border-box;
   background-color:yellow;
}

#middle {
   height:100%;
   margin-left:89px;
   box-sizing:border-box;
}

#rightSidebar {
   position:fixed;
   top:0;
   right:0;
   height:100%;
   margin:5px;
   box-sizing:border-box;
   background-color:blue;
}

#middle, #rightSidebar
 {
   width:calc(51% - 41px);
}

article {
   width:98%;
   height:81px;
   margin:5px 0;
   background-color:pink;
}
</style> 
 </head> 
 <body> 
  <section id="leftSidebar"> 
   <p> leftSidebar </p> 
  </section> 
  <div class="main"> 
   <section id="middle"> 
    <article>
      middle 
    </article> 
    <article>
      middle 
    </article> 
    <article>
      middle 
    </article> 
    <article>
      middle 
    </article> 
    <article>
      middle 
    </article> 
    <article>
      middle 
    </article> 
    <article>
      middle 
    </article> 
    <article>
      middle 
    </article> 
    <article>
      middle 
    </article> 
    <article>
      middle 
    </article> 
    <article>
      middle 
    </article> 
    <article>
      middle 
    </article> 
   </section> 
   <section id="rightSidebar"> 
    <p> rightSidebar </p> 
   </section> 
  </div>  
 </body>
</html>

Related Tutorials