Is there any way I could resize my div elements without leaving gaps on the page? I think the only option is to calculate the possible generated gaps and move the elements around. Thanks in advance for any idea.
onclick you could change the positioning of the card's div to absolute and increase the z-index so that it is displayed above all other cards. I would suggest you create another wrapper div around each card with relative positioning to lock the boundaries in place when you switch to absolute positioning on the card.
this solution would allow all cards except the currently selected one to maintain their position.