DEV Community

Discussion on: Responsive hexagon grid without media query

Collapse
 
thaimon profile image
Thaimon

Hi, very nice script.
I'd like to have the indentation beginning on the first row. Can you help me?

Collapse
 
afif profile image
Temani Afif

in the shape-outside use this repeating-linear-gradient(
#000 0 3px,
#0000 0 var(--f))

and in the --f you will find - 1px, replace it with + 1px

Collapse
 
thaimon profile image
Thaimon

Thanks for your help :)

I encountered a problem.
You can also test it with your example on codepen.

When you put the size to 200px (--s: 200px;) and look at it from a mobile device or resize your browser to mobile dimensions, then the last hexagon misbehaves.
This also occurs with the original code/indentation.

Can you help me again?

Thread Thread
 
thaimon profile image
Thaimon

I found a solution, but maybe you have a better one.
I just added a couple of extra hexagons and made them invisible.
visibility: hidden;
This way all the visible hexagons have the correct indentation, the last (visible) ones aswel.
The invisible hexagons will still be out of place, but it doesn't matter because nobody sees them.