Hover to Reveal Details Card

Add an element of interactive discovery to your portfolio or product grid with this "hover to reveal" card.

This is a popular pattern for modern, minimalist layouts. It keeps the initial view clean by showing just an image and a title. When the user hovers over the card, a descriptive overlay smoothly animates into view, offering more context and a call-to-action.

Screenshot showing a card with a details overlay appearing on hover.

Get Source Code Preview

About this Component

The entire effect is powered by CSS transitions and the :hover pseudo-class. On hover, the initially visible title fades out while the detailed information overlay simultaneously fades in and slides up from the bottom, creating a smooth and seamless transition. This is a CSS-only component and requires no JavaScript.

Features

Code Breakdown

HTML Structure

The entire card is a single a tag. This serves as the main container and makes the whole component clickable. Inside are three main elements: the background img, a div for the initially visible content (.reveal-card-initial-content), and another div for the hidden overlay content (.reveal-card-hover-content).

CSS Styling

The parent a tag (.reveal-card) is set to position: relative to act as a positioning context for its children. The two content blocks are then positioned absolutely within this container.

The animation is created with opacity and transform. The hover content (.reveal-card-hover-content) starts with opacity: 0 and is pushed completely out of view with transform: translateY(100%). When a user hovers over the parent .reveal-card, the CSS targets this hover content to animate it to opacity: 1 and transform: translateY(0), making it slide up into view. The transition property on both elements ensures this change happens smoothly over a fraction of a second.

Code

Here's the complete, self-contained code. Simply update the image and text to create your own interactive gallery.

View Output