Responsive grid with fixed column width - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

Responsive grid with fixed column width

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 {<!-- w  w  w.  j  ava2 s  . c o m-->
   border:3px solid Chartreuse;
   height:100px;
   width:100%;
   position:relative;
   display:flex;
}

#sub {
   border:2px solid yellow;
   width:calc(100% / 4);
   height:calc(100% - 41px);
   padding:11px;
   margin:6px;
   display:inline-block;
}
</style> 
 </head> 
 <body> 
  <div id="main"> 
   <div id="sub">
     Lorem 
   </div> 
   <div id="sub">
     Lorem 
   </div> 
   <div id="sub">
     Lorem i 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials