body { margin: 0 auto; max-width: 56em; padding: 1em 0; } .grid { /* Grid Fallback */ display: flex; flex-wrap: wrap; /* Supports Grid */ display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); grid-auto-rows: minmax(150px, auto); grid-gap: 1em; } .module { /* Demo-Specific Styles */ background: #eaeaea; display: flex; align-items: center; justify-content: center; height: 200px; /* Flex Fallback */ margin-left: 5px; margin-right: 5px; flex: 1 1 200px; } /* If Grid is supported, remove the margin we set for the fallback */ @supports (display: grid) { .module { margin: 0; } }