Set margin between columns - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Column Layout

Description

Set margin between columns

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 {<!--  ww w  .j  a va 2  s  .  c o m-->
   width: 100%;
}
.clearfix:after {
   content: ".";
   display: block;
   clear: both;
   visibility: hidden;
   line-height: 0;
   height: 0;
}
.clearfix {
   display: inline-block;
}
html[xmlns] .clearfix {
   display: block;
}
* html .clearfix {
   height: 1%;
}
.onethird {
   width:30%;
   margin-left:5%;
   float:left;
   box-sizing:border-box;
   -moz-box-sizing:border-box; 
   -webkit-box-sizing:border-box;
}
.onethird:first-child {
   float:left;
   margin-left:0;
}
.onethird.third {
   float: right;
}


      </style> 
 </head> 
 <body> 
  <div class="container clearfix"> 
   <div class="onethird">
     this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test 
   </div> 
   <div class="onethird">
     this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test 
   </div> 
   <div class="onethird third">
     this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test 
   </div> 
   <div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials