Why do grid gaps get bigger during transition
As you can see here: https://codepen.io/Lko3001/pen/gOVLwVz, when you hover over the card, there's a weird space between the title and the description, it's caused from the grid-template-row but I dont understand why and how to fix it
20 Replies
Do you need the outline? or is that for testing?
My solution was just to put
align-content: end;
in the grid parent.
that way it all starts from the bottom
if you keep the outline though it will grow before the children
You could also play with adding a animation/keyframes.@b1mind even with align-content: end and without the outline there's still the same problem
what happens is the gird needs to calculate height then animate, so its still happening just now its above the text, 1fr takes up all remaining space with auto.
So if you keep on the outline you will see it still works the same but your auto stays end of its cell while it happens
@b1mind sorry I put it on the
.grid
before, now it works, and thanks for the explanation, I still dont understand why there's that space tho. I get that it needs to calculate the height but why isn't it doing at the same time as the text?
Also yeah I need to learn how to use justify-items
and align-content
betteracutally I was wrong
its auto that is creating the space
you can click on grid inspector and see it.
Yeah I know but what else can I use instead of auto
grid grows auto kinda goes derp
mmm personally I wouldn't probably do this with animating grid.
but I've also not played with it cause its still rather new
I know there is still some jank though xD
how would you do it? I don't want to use js or hardcode stuff
hidden on the card and translate
š¤·āāļø
?
oh wait
better said, you need to learn content/items for grid better
when to use content when to use items
No how would you do it? because if I put translate on the
.content-wrapper
it doesnt affect the position of the title, I was thinking about doing something like margin-bottom: -100%
but 100%
is the height of all the textI have to run but I'm sure this will nerd snipe someone.
yeah probably
If not I'll maybe make a demo when I get home
I'm sure there are lots on codpen already though
Thanks anyways
The only "solution" i found is to do something like this, the problem is that i'm hardcoding a value in
max-height
and the animations are weird when you do that. But that's the best I got
Interpolate-size : allow-keywords is going to solve this issue. And calc-size()
Yeah I know but they're not supported basically anywhere