CSS boxes positioning - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

CSS boxes positioning

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">
.box {<!--from  ww w  .ja  v a2  s .  c o m-->
   float:left;
   margin:0 11px 11px 0;
   background-color:Chartreuse;
   width:100px;
   height:31px;
}

.box.l {
   height:71px;
   margin-top:-41px;
}

.box.s:nth-child(2) {
   clear:left;
}

.box.s:nth-child(4) {
   margin-top:-41px;
}
</style> 
 </head> 
 <body> 
  <div class="box s">
    Lorem 
  </div> 
  <div class="box s">
    Lorem 
  </div> 
  <div class="box l">
    Lorem i 
  </div> 
  <div class="box s">
    Lorem 
  </div> 
  <div class="box s">
    Lorem 
  </div>  
 </body>
</html>

Related Tutorials