• Skip to main content
  • Skip to primary sidebar

Web Development Archive

  • Archive
You are here: Home / CSS / CSS Grid with Media Queries

CSS Grid with Media Queries

/* ===================================== 
    Grid Layout
 ======================================== */
 .container {
   height: 100vh;
   display: grid;
   grid-template-columns: 1fr;
   grid-auto-rows: minmax(150px, auto);
   grid-gap: 10px;
   grid-template-areas: 
     "header"
     "nav"
     "main"
     "aside"
     "footer";
 }
 header {
   grid-area: header;
 }
 nav {
   grid-area: nav;
 }
 main {
   grid-area: main;
 }
 aside {
   grid-area: aside;  
 }
 footer {
   grid-area: footer;
 }
 @media (min-width: 768px) {
   .container {
     grid-template-columns: 1fr 2fr 1fr;
     grid-template-rows: 100px minmax(150px, auto) 100px;
     grid-template-areas: 
       "header header header"
       "nav main aside"
       "footer footer footer";
   }
 }
 @media (min-width: 992px) {
   .container {
     grid-template-areas: 
       "header header header"
       "nav main aside"
       "nav footer footer";
   }
 }

Filed Under: CSS Tagged With: Grid

About Gabor Flamich

I'm a web developer and designer based in Budapest, Hungary. In recent years, I've documented hundreds of solutions I came across during development. This site is an archive for useful code snippets on WordPress, Genesis Framework and WooCommerce. If You have any questions related to WordPress development, get in touch!

Primary Sidebar

  • angular.io
© 2026 WP Flames - All Right Reserved