You can try like below. You were almost good, missing grid-auto-flow:dense; to allow the item to fill all the spaces.
.grid-container {
padding: 20px;
display: grid;
grid-gap: 20px;
grid-auto-rows: 1fr;
grid-template-columns: repeat(2, 1fr);
grid-auto-flow:dense;
counter-reset: albumList;
}
.item {
aspect-ratio: 1;
background: #ccc;
display: flex;
}
/* Number */
.item:before {
counter-increment: albumList;
content: counter(albumList);
margin: auto;
font-size: 40px;
color: #000000;
}
@media screen and (min-width: 40em) and (max-width: 63.99875em) {
/* 640 ~ 1023 */
.grid-container {
grid-template-columns: repeat(3, 1fr);
}
.item:nth-child(6n + 1),
.item:nth-child(6n + 6){
grid-area: span 2/span 2;
}
.item:nth-child(6n + 5) {
grid-column: 1;
}
}
@media print, screen and (min-width: 64em) {
/* 1024+ */
.grid-container {
grid-template-columns: repeat(4, 1fr);
}
.item:nth-child(10n + 1),
.item:nth-child(10n + 10){
grid-area: span 2/span 2;
}
.item:nth-child(10n + 8) {
grid-column: 1;
}
.item:nth-child(10n + 9) {
grid-column: 2;
}
}
<div class="grid-container">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
Answer from Temani Afif on Stack OverflowPure
pure-css.github.io › grids
Grids - Pure
Pure Grids consist of two types of classes: the grid class (pure-g) and unit classes (pure-u or pure-u-*) ... Units have various class names that represent their widths. For example, pure-u-1-2 has a width of 50%, whereas pure-u-1-5 would have a width of 20%.
TutorialsPoint
tutorialspoint.com › purecss › purecss_grids.htm
Pure.CSS - Grids
<html> <head> <title>The PURE.CSS .../grids-responsive-min.css"> <style> .grids-example { background: rgb(250, 250, 250); margin: 2em auto; font-family: Consolas, 'Liberation Mono', Courier, monospace; text-align: center; } .grid-unit { margin: 0.25em 0; padding-left: 4.5em; } ...
Videos
Pure CSS grid
04:37
Learn How to Make a Responsive CSS Grid Layout - YouTube
09:59
Simple pure CSS icon grid - YouTube
05:48
How to create fully responsive grid image gallery with pure CSS ...
06:45
Pure CSS Responsive Masonry Grid Layouts | Grid Like Pinterest ...
W3Resource
w3resource.com › pure › grid.php
A tutorial on Responsive and unresponsive Grids by Pure CSS - w3resource
August 19, 2022 - It is not supported by all of the ... of Grids. In the example below, we have created a simple two column layout and then the left grid is nesting another three column grid....
GitHub
github.com › pure-css › grunt-pure-grids
GitHub - pure-css/grunt-pure-grids: Generate custom units for Pure Grids.
In this example, we just create a regular 12-column Pure grid. grunt.initConfig({ pure_grids: { twelveCols: { dest: 'path/to/my-grid.css', options: { units: 12, //12-column grid } } } }); In this example, we create a 6-column responsive grid ...
Starred by 13 users
Forked by 7 users
Languages CSS 66.6% | JavaScript 33.4% | CSS 66.6% | JavaScript 33.4%
Awesomelionel
awesomelionel.github.io › purecss-grid-example
Pure CSS | Layout example
This is an example site to show how you could use Pure CSS griding system to layout your site.
Coderepublics
coderepublics.com › Purecss › Purecss-grids.php
Pure CSS Grid - CodeRepublics
July 9, 2021 - <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title> Pure.CSS Grids </title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://unpkg.com/purecss@1.0.1/build/pure-min.css"> <style> .grids-example { background: rgb(250, 250, 250); font-family: Roboto, 'Liberation Mono', Courier, monospace; } .grid-unit { padding-left: 30px; padding-top: 5px; } .grid-unit .grid-unit-width { font-family: Roboto, 'Liberation Mono', Courier, monospace; } .grid-unit-bar { height: 30px; border-radius: 5px; background: #7559ca; margin-bottom: 10p
i2tutorials
i2tutorials.com › home › pure css tutorial › pure css – grids
Pure CSS - Grids | i2tutorials
October 15, 2019 - Example: <div class="pure-g"> <div class="pure-u-1-4"><p>First Unit</p></div> <div class="pure-u-1-4"><p>Second Unit</p></div> <div class="pure-u-1-4"><p>Third Unit</p></div> <div class="pure-u-1-4"><p>Fourth Unit</p></div> </div>
Arnaudleray
arnaudleray.github.io › pocketgrid
PocketGrid - Pure CSS responsive and semantic grid system
PocketGrid · Tiny and powerful CSS grid system · PocketGrid is a tiny and powerful grid system. It offers many awesome features: · Features · Flexible · Unlimited number of columns · Unlimited nested grids · Automatic rows · Customisable gutters
FreeFrontend
freefrontend.com › css-grid
162 CSS Grid Examples
1 week ago - It transforms a standard CSS Grid of cards into an interactive, animated gallery. Its function is to elegantly expand a selected item to full width, smoothly reflowing the remaining siblings using native browser rendering instead of complex JavaScript math. ... This is an Animated Ripple Dot Grid Loader. It utilizes pure CSS and complex keyframe choreography to render a highly synchronized loading state.
GitHub
github.com › awesomelionel › purecss-grid-example
GitHub - awesomelionel/purecss-grid-example: A example site to showcase Pure CSS Grid system @ http://awesomelionel.github.io/purecss-grid-example
This is a simple example site to visually show how you could use Pure CSS to apply responsive grids to your website layout.
Author awesomelionel
GeeksforGeeks
geeksforgeeks.org › css › pure-css-grids
Pure CSS Grids - GeeksforGeeks
July 23, 2025 - While creating a genuine responsive website layout the grid system is a crucial tool for web developers. A grid is a set of classes that helps us to divide the width of the screen or display into smaller units and make the website look responsive on various devices. Pure.CSS also comes up with ...
Grid by Example
gridbyexample.com › examples
Grid by Example - Usage examples of CSS Grid Layout
You can create grids using percentage values for tracks and gaps. An example to demonstrate the difference between the auto-fill and auto-fit keywords in repeat notation
Pure
pure-css.github.io › start
Get Started - Pure
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/purecss@3.0.0/build/grids-responsive-min.css"> Here's the default responsive breakpoints included in grids-responsive.css: Here's an example of what you'd be able to do.
Creative Bloq
creativebloq.com › web design › css
A comprehensive guide to using CSS Grid | Creative Bloq
January 7, 2021 - Overlapping elements can also be achieved using CSS Grid. Multiple items can occupy the same grid cells and hence can overlap with one another, utilising the z-index properties of the items to control the order in which they stack. ... For example, we can add a semi-transparent element with the class toolbar inside the grid container and position it in the right-most column so that it overlaps with all the other elements (figure 4):