fix the position of div's in responsive UI - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

fix the position of div's in responsive UI

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>Lorem ipsum dolo</title> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
.grid-container {<!--from w ww. ja v a2 s.c  o  m-->
   display:grid;
   grid-template-columns:2fr 2fr 2fr 2fr;
   grid-template-rows:2fr 2fr 2fr;
   grid-template-areas:"left-top center-left-top center-right-top right-top"
   "left-middle center-left-middle center-right-middle right-middle"
   "left-bottom center-left-bottom center-right-bottom right-bottom";
}

.item-1 {
   grid-area:left-top
}

.item-2 {
   grid-area:center-left-top
}

.item-3 {
   grid-area:center-right-top
}

.item-4 {
   grid-area:right-top
}

.item-5 {
   grid-area:left-middle
}

.item-6 {
   grid-area:center-left-middle
}

.item-7 {
   grid-area:center-right-middle
}

.item-8 {
   grid-area:right-middle
}

.item-9 {
   grid-area:left-bottom
}

.item-10 {
   grid-area:center-left-bottom
}

.item-11 {
   grid-area:center-right-bottom
}

.item-12 {
   grid-area:right-bottom
}
</style> 
 </head> 
 <body> 
  <meta charset="utf-8"> 
  <div class="grid-container"> 
   <div class="grid-item item-1">
     Lorem i 
   </div> 
   <div class="grid-item item-2">
     Lor 
   </div> 
   <div class="grid-item item-3">
     Lor 
   </div> 
   <div class="grid-item item-4">
     Lorem i 
   </div> 
   <div class="grid-item item-5">
     Lor 
   </div> 
   <div class="grid-item item-6">
     Lorem i 
   </div> 
   <div class="grid-item item-7">
     Lor 
   </div> 
   <div class="grid-item item-8">
     Lorem i 
   </div> 
   <div class="grid-item item-9">
     Lor 
   </div> 
   <div class="grid-item item-10">
     Lorem ip 
   </div> 
   <div class="grid-item item-11">
     Lore 
   </div> 
   <div class="grid-item item-12">
     Lore 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials