'How to remove the space after applying translation [duplicate]

I have an image at the starting of a card and just below it has a user profile image as you can see in the first image. The first image with no tranformation

After this I applied a transform (translation) property in CSS and moved the user profile image above to the y-axis as you can see in the image below that the image is shifted up but there is an extra space below the image with is left behind.

Result after I applied the transform - translate y property I want to remove this space so that the line or any other content below this image is placed just after the image with no free space. I Applied transform: translateY(-35px);.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source