CSS Grid Flow Different Sized Blocks - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Grid

Description

CSS Grid Flow Different Sized Blocks

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">
* {<!--  ww  w . ja  v  a 2  s  .  com-->
   padding:0;
   margin:0;
   box-sizing:border-box;
}

body {
   padding:6em;
}

.grid {
   display:grid;
   grid-template-columns:26% 26% 26% 26%;
   grid-gap:2em 2em;
   grid-auto-flow:row dense;
}

.item {
   background:Chartreuse;
   border-radius:0.26em;
   padding:3em;
}

.large {
   background:yellow;
   grid-column:auto / span 3;
   grid-row:auto / span 12;
}
</style> 
 </head> 
 <body> 
  <div class="grid"> 
   <div class="item">
     Lorem ips 
   </div> 
   <div class="item">
     Lorem ips 
   </div> 
   <div class="item large">
     Lorem ips 
   </div> 
   <div class="item large">
     Lorem ips 
   </div> 
   <div class="item">
     Lorem ips 
   </div> 
   <div class="item">
     Lorem ips 
   </div> 
   <div class="item">
     Lorem ips 
   </div> 
   <div class="item">
     Lorem ips 
   </div> 
   <div class="item">
     Lorem ips 
   </div> 
   <div class="item">
     Lorem ips 
   </div> 
   <div class="item">
     Lorem ips 
   </div> 
   <div class="item">
     Lorem ipsu 
   </div> 
   <div class="item">
     Lorem ipsu 
   </div> 
   <div class="item">
     Lorem ipsu 
   </div> 
   <div class="item">
     Lorem ipsu 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials