Get the latest tech news

Hexagons and Beyond: Flexible, Responsive Grid Patterns, Sans Media Queries (20


A little while back, Chris shared this nice hexagonal grid. And true to its name, it’s using —wait for it — CSS Grid to form that layout. It’s a neat trick!

I am using the container::before pseudo-element to create a float element that take up all the height at the left of the grid, and that has a width equal to half a hexagon (plus its margin). With no more than 15 CSS declarations, we have a responsive grid that fit nicely into all the screen sizes and we can easily adjust things by simply controling two variables. To make things easier, I am expressing the vc and hc as percetange of the width and height so we can easily scale our elements without breaking the clip-path

Get the Android app

Or read this on Hacker News

Read more on:

Photo of hexagons

hexagons

Photo of sans media queries

sans media queries