Grid-gap on mobile - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Grid

Description

Grid-gap on mobile

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">
.grid {<!-- www. j  av  a 2  s  . c o m-->
   background-color:Chartreuse;
}

.upper, .lower {
   display:grid;
}

.upper {
   grid-template-columns:2fr 2fr;
   grid-gap:26px;
}

.lower {
   grid-template-columns:2fr;
   grid-template-rows:auto;
   grid-gap:11px;
}

.upper>* {
   border:2px dashed yellow;
   background-color:blue;
}

.lower>* {
   border:2px dashed pink;
   background-color:OrangeRed;
}

@media (max-width: 800px)  {
   .upper {
      grid-template-columns:2fr;
      grid-template-rows:auto;
   }

}
</style> 
 </head> 
 <body> 
  <div class="grid"> 
   <div class="upper"> 
    <div class="a">
      Lor 
    </div> 
    <div class="b">
      Lor 
    </div> 
   </div> 
   <div class="lower"> 
    <div class="c">
      Lor 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials