Increase additional height of a dynamic element
I wanted to increase the height ( ON HOVER to show the description ) of the div element which has a dynamic height of the inner element (i.e. an image), if someone can help me with this query it would be really helpful 🙏
Basic HTML:
Basic CSS (just added the hover-effect on the image and not any other effects):
9 Replies
Be sure to use code blocks to avoid the formatting issues you’re having.
See #How To Ask Good Questions for the syntax
One idea would be to use grid-template-rows animation/transition.
You could wrap the description block in it's a wrapper and set it to have
https://codepen.io/cbolson/pen/dyBmPXq Note - This method would require extra markup and I suspect that it wouldn't play nicely with your use of columns
grid-template-rows: 0fr;
Then, on hover, this would then be changed to grid-template-rows: 1fr;
A quick demo:https://codepen.io/cbolson/pen/dyBmPXq Note - This method would require extra markup and I suspect that it wouldn't play nicely with your use of columns
thanks for the reply, but i specifically want the height of the
img-cont
increased, cause I want it to play the transition of sliding the img description down from the image (or more like extending the container to show the description)... i specifically want the height of the img-cont increased, cause I want it to play the transition of sliding the img description down from the image
You didn't mention that in your original post.
I have updated my codepen to slide the description down from the image with a simple translate.
ooh sorry, and does the
img-cont
extend its height ? 😬ooh not the image itself just the white container, cause I just don't get how to increase its height as it is dynamically set because of the image's height
As I mentioned earlier, my concern with doing this would be the fact that you are using
columns
.
As the images are hovered and extend in height I suspect that this will mess with the layout, moving things from one column to another as the browser attempts to balance things out between them.don't worry bout it, the columns can do whatever they want (i.e. snapping elements to other columns) I just want the
img-cont
to smoothly increase it's height and display the description