My approach is as follows:
Upon clicking an image (refer to the screenshot provided), I intend for text related to that specific image to be displayed beneath the row of images (circles). To achieve this, I experimented with using transitions. Initially, I created a parent div (colored green) with its position set to relative, and a child div (colored red) with its position set to absolute. I then animated the top property of the child div, resulting in the desired effect.
.parent { position: relative; }
.child { position: absolute; top: -100px; transition: top 1s linear; }
.child:target { top: 0; }
However, I encountered an issue when attempting to have additional divs below the sliding text content (the 'test' text in the demonstration) push down as the text expanded. This limitation arises from the fact that when a child div's position is set to absolute, the height of the parent div (green box) does not automatically adjust accordingly.
Therefore, my question stands: Is there a method to resolve this challenge?
Thank you for sharing your insights.
PS: As shown in the screenshot, the green box's height exceeds that of the red box due to another invisible red div positioned below the visible one, but obscured by having opacity set to 0.