Create layout HTML with different div with different height - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Layout

Description

Create layout HTML with different div with different height

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">
pre {<!--   w w w  .j a  v a 2s  .  com-->
   margin:0 padding:0;
}

.block1 {
   width:100%;
   height:100%;
   border:2px solid;
   border-color:Chartreuse;
   margin:0;
   padding:0;
}

.block2 {
   width:100%;
   height:100%;
   border:2px solid;
   border-color:yellow;
   margin:0;
   padding:0;
}

.block3 {
   width:100%;
   height:100%;
   border:2px solid;
   border-color:blue;
   margin:0;
   padding:0;
}

.block4 {
   width:100%;
   height:100%;
   border:2px solid;
   border-color:pink;
   margin:0;
   padding:0;
}

.block5 {
   width:100%;
   height:100%;
   border:2px solid;
   border-color:OrangeRed;
   margin:0;
   padding:0;
}

.g-block-1 {
   width:51%;
   height:100%;
   float:left;
   display:inline-block;
   margin:0;
   padding:0;
}

.g-block-2 {
   width:51%;
   float:right;
   height:100%;
   display:inline-block;
   margin:0;
   padding:0;
}
</style> 
 </head> 
 <body> 
  <div> 
   <div class="g-block-1"> 
    <div class="block1"> 
     <pre>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. </pre> 
    </div> 
    <div class="block2"> 
     <pre>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat volutpat. Ves</pre> 
    </div> 
   </div> 
   <div class="g-block-2"> 
    <div class="block3"> 
     <pre>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ull</pre> 
    </div> 
    <div class="block4"> 
     <pre>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ull</pre> 
    </div> 
    <div class="block5"> 
     <pre>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ull</pre> 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials