CSS only Twitter/Whatsapp style image grid
Is it possible, using just HTML and CSS, to create an automatically adapting image display element for between 1 and 4 images? e.g.
a square 2 x 2 grid: if there's one image , it just shows 1 square image covering all 4 cells. If there are 2 images, 2 1x2 rectangles side by side. 3 images, 1 1x2 rectangle and 2 1x1 squares, and 4 images, 4 1x1 squares.
1 Reply
it feels like there should be some way to do it with flexbox but I don't know where to start... I would probably just use grid and javascript to adjust things dynamically 😄