From 15e33875a06c0669a98e96f454278c1b42989d8f Mon Sep 17 00:00:00 2001 From: hugogogo Date: Thu, 19 Nov 2026 16:47:44 +0100 Subject: [PATCH] grid images scale correctly --- src/modules/portfolio.html | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/modules/portfolio.html b/src/modules/portfolio.html index 9e1d2dc..9f7181f 100644 --- a/src/modules/portfolio.html +++ b/src/modules/portfolio.html @@ -22,14 +22,18 @@ gap: 10px; } - /* dense image grid : ~200px cells, flexible down to phone widths, - same max width as the .cv container */ + /* image grid, pure grid (no media queries) : the column count follows + the container width automatically. min(220px, 48%) => max 4 columns + at 1100px (5x220px doesn't fit) and never less than 2 columns + (2x48% + gap always fits). Same max width as the .cv container */ .images_grid { display: grid; - grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); + grid-template-columns: repeat(auto-fill, minmax(min(220px, 48%), 1fr)); gap: 10px; - width: auto; - max-width: 1100px; + /* definite width tracking the viewport (the parent grid column is + auto-sized, so width:auto would stay at max-content = 1100px), + capped at the same max width as the .cv container */ + width: min(1100px, calc(100vw - 20px)); img { width: 100%;