Css fluid layout with fixed column - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Column Layout

Description

Css fluid layout with fixed column

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">

section {<!--   w w  w . j ava  2s. com-->
   width: 100%;
}
#wrap {
   margin: 0 auto;
   max-width: 600px;
   width: 100%;
   display: table;
}
#col1 {
   width: 100%;
   height: 100px;
   background: lightblue;
   display: table-cell;
}
#col2 {
   width: 200px;
   height: 100px;
   background: lightgreen;
}
h1 {
   height: 40px;
   width: 50px;
   background: red;
}
h1, p {
   display: inline-block;
   vertical-align: bottom;
}
p {
   display: inline-table;
   width: 100%;
}
@media only screen and (max-width: 400px) {
   #col1 {
      display: block;
   }
   #col2 {
      width: 100%;
   }
}


      </style> 
 </head> 
 <body> 
  <section> 
   <div id="wrap"> 
    <div id="col1">
      Col 1: 200px width 
    </div> 
    <div id="col2">
      Col 2: dynamic 
    </div> 
   </div> 
  </section>  
 </body>
</html>

Related Tutorials