Using CSS to make a liquid grid of uniformly sized divs with margins - HTML CSS CSS Form

HTML CSS examples for CSS Form:Form

Description

Using CSS to make a liquid grid of uniformly sized divs with margins

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">
body {<!--   w  w w. j av a 2s.  c om-->
   background-color:Chartreuse;
   position:absolute;
   top:0;
   bottom:0;
   left:0;
   right:0;
}

#buttons {
   overflow:hidden;
   height:100%;
}

.button {
   position:absolute;
   top:0;
   bottom:0;
   left:0;
   right:0;
   margin:3%;
   background:yellow;
   color:blue;
   text-align:center;
   border-radius:0.2em;
   font-weight:701;
}

.outer {
   position:relative;
   float:left;
   width:34.34%;
   height:34.34%;
}
</style> 
 </head> 
 <body> 
  <div id="buttons"> 
   <div class="outer"> 
    <div id="seven" class="button">
      Lor 
    </div> 
   </div> 
   <div class="outer"> 
    <div id="eight" class="button">
      Lor 
    </div> 
   </div> 
   <div class="outer"> 
    <div id="nine" class="button">
      Lor 
    </div> 
   </div> 
   <div class="outer"> 
    <div id="four" class="button">
      Lor 
    </div> 
   </div> 
   <div class="outer"> 
    <div id="five" class="button">
      Lor 
    </div> 
   </div> 
   <div class="outer"> 
    <div id="six" class="button">
      Lor 
    </div> 
   </div> 
   <div class="outer"> 
    <div id="one" class="button">
      Lor 
    </div> 
   </div> 
   <div class="outer"> 
    <div id="two" class="button">
      Lor 
    </div> 
   </div> 
   <div class="outer"> 
    <div id="three" class="button">
      Lor 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials