CSS Grid auto-fill property doesn't work inside other container

Just open the fiddle below, comment at ‘max-width’ property of .wrap div.

This result is expected, but once the parent element has width, autofit is not working anymore.

https://jsfiddle.net/artrayd/nxseurz2/9/

I am not big expert of css-grid, but it looks very useful, but also complicated…

It seems the auto-fill will fill only the maximum width that you allowed it.
you used max-width of 80% of the view height maybe you intended to use view width (vw instead of vh)

1 Like

Kipoph, yeas! You are absolutely right… By some reason, in my another website it doesn’t work this way, parent’s div width stays small no matter how many items are inside… Can’t figure why

Thank you a lot

Here I got it. Parent container is set to flex. Is it possible to get it working inside flexbox div?

https://jsfiddle.net/artrayd/nxseurz2/12/