Items grid with inner padding only - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Grid

Description

Items grid with inner padding only

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">
.clearfix {<!-- w  ww  .j  av  a 2 s  . co  m-->
   clear:both
}

#products {
   border:2px solid Chartreuse;
   width:961px;
}

.item {
   float:left;
   background-color:yellow;
   border:2px solid blue;
   width:301px;
   height:100px;
   margin-left:3.6%;
   margin-top:3.6%;
}

.item:first-child, .item:first-child + *, .item:first-child + * + * {
   margin-top:0px;
}

.item:first-child,
.item:first-child + * + * + *,
.item:first-child + * + * + * + * + * + *,
.item:first-child + * + * + * + * + * + * + * + * + * {
   margin-left:0px;
}
</style> 
 </head> 
 <body> 
  <div id="products"> 
   <div class="item"></div> 
   <div class="item"></div> 
   <div class="item"></div> 
   <div class="item"></div> 
   <div class="item"></div> 
   <div class="item"></div> 
   <div class="item"></div> 
   <div class="item"></div> 
   <div class="item"></div> 
   <div class="clearfix"></div> 
  </div>  
 </body>
</html>

Related Tutorials