make div expand width 100% responsively - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

make div expand width 100% responsively

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">
#main {<!--from  w w w.  java2  s  .  c  om-->
   width:100%;
   display:table;
   border:2px solid Chartreuse;
   position:relative
}

#left {
   display:table-cell;
   width:100px;
   vertical-align:middle;
   text-align:center;
   background:red
}

#right {
   display:table-cell;
   width:100%;
   vertical-align:middle;
   background:lightblue;
   text-align:left;
}
</style> 
 </head> 
 <body> 
  <div id="main"> 
   <div id="right">
     Lorem 
    <br>Lorem 
    <br>Lorem 
    <br>Lorem 
    <br>Lorem 
    <br>Lorem 
    <br>Lorem ipsum dolor sit amet, consectetur adip 
    <br> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials