Center a grid made out of circles on a webpage - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Grid

Description

Center a grid made out of circles on a webpage

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">
ul {<!--  w  ww.  ja  v  a  2  s. c om-->
   padding:0;
   margin:0;
   display:grid;
   grid-template-rows:repeat(auto-fill, 221px);
   grid-template-columns:repeat(auto-fill, 221px);
   grid-gap:0px;
}

li.small {
   width:201px;
   height:201px;
   background-color:Chartreuse;
   border-radius:51%;
   grid-row:auto / span 2;
   grid-column:auto / span 2;
   margin:0 auto;
}

li.big {
   margin:0 auto;
   width:401px;
   height:401px;
   background-color:yellow;
   border-radius:51%;
   grid-row:auto / span 3;
   grid-column:auto / span 3
}

li {
   display:block;
   padding:0;
   margin:0;
   align-self:center;
   justify-self:center;
}
</style> 
 </head> 
 <body> 
  <ul> 
   <li class="small"></li> 
   <li class="small"></li> 
   <li class="small"></li> 
   <li class="small"></li> 
   <li class="big"></li> 
   <li class="small"></li> 
   <li class="small"></li> 
   <li class="small"></li> 
   <li class="small"></li> 
   <li class="small"></li> 
   <li class="small"></li> 
   <li class="small"></li> 
   <li class="small"></li> 
   <li class="big"></li> 
   <li class="small"></li> 
   <li class="small"></li> 
   <li class="small"></li> 
   <li class="small"></li> 
   <li class="small"></li> 
   <li class="small"></li> 
   <li class="small"></li> 
   <li class="small"></li> 
   <li class="big"></li> 
   <li class="small"></li> 
   <li class="small"></li> 
   <li class="small"></li> 
   <li class="small"></li> 
  </ul>  
 </body>
</html>

Related Tutorials