Make 10 divs in a row with 10% width each - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Width

Description

Make 10 divs in a row with 10% width each

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">
.container {<!-- w  w w.j  av a 2  s  . c  o m-->
   width:961px;
   background:red;
   margin:0 auto;
}

.container:after {
   display:table;
   content:'';
   clear:both;
}

.tenPercent {
   color:Chartreuse;
   float:left;
   border:2px solid yellow;
   width:11%;
   -webkit-box-sizing:border-box;
   -moz-box-sizing:border-box;
   box-sizing:border-box;
}
</style> 
 </head> 
 <body> 
  <div class="container"> 
   <div class="tenPercent">
     1 
   </div> 
   <div class="tenPercent">
     2 
   </div> 
   <div class="tenPercent">
     3 
   </div> 
   <div class="tenPercent">
     4 
   </div> 
   <div class="tenPercent">
     5 
   </div> 
   <div class="tenPercent">
     6 
   </div> 
   <div class="tenPercent">
     7 
   </div> 
   <div class="tenPercent">
     8 
   </div> 
   <div class="tenPercent">
     9 
   </div> 
   <div class="tenPercent">
     10 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials