grid item auto stretch
Hi guys, I want the height of grid item fit-content but it auto stretch. I use
align-self: start
for grid item but it does not work. Can anyone help me explain why? Here is my css container
6 Replies
I would recommend putting all your html/css/js into a codepen so someone can better help you debug.
Also explain the behaviour youre looking for, you want it to fit content but you also want it to stretch? thats not possible with one element.
also,
flex: 1
wont do what you expectif i understand correctly, i'm pretty sure you have to give your "cards" a height of 100% if they're not the direct children on that grid. Otherwise
align-items: stretch;
can't access them, only their containers.align-self will make them dense not stretch.
start is also default so really I don't see why you used it in this case.
also grid children fill by default so
had the screenshot up and noticed you made all the children flex col too 🤦♂️ ... use grid. Flex makes children dense by default too
flex col is 90% of the time not what you want... I don't see why people over use it so much when you could just use grid (updated my pen)