Here is an example code snippet that achieves the desired functionality using HTML, CSS, and JavaScript:
149 chars6 lines
308 chars19 lines
index.tsx475 chars20 lines
Explanation:
#image-gallery
CSS rule sets the styles for the container div, including its height, which is set to 80% of the viewport height (vh).#image-gallery img
CSS rule sets the maximum size for each image to be its container's height or width, whichever is smaller, so that the images always fit within the container, and also sets the transition for image hover animations.#image-gallery img:hover
CSS rule sets the styles for when an image is hovered over by the mouse, including a slight scale up transformation and a grayscale filter effect to draw attention to the image.gistlibby LogSnag