CSS Hover Reveal Card

An image card whose caption slides up with extra details on hover.

  • image
  • overlay
  • caption
  • hover
  • reveal
HTML
<div class="reveal-card">
  <div class="reveal-caption">
    <h3>Mountains</h3>
    <p>Hover to read more</p>
  </div>
</div>
CSS
.reveal-card {
  position: relative;
  overflow: hidden;
  width: 220px;
  height: 150px;
  border-radius: 16px;
  /* Swap for: url(photo.jpg) center / cover */
  background: linear-gradient(160deg, #38bdf8, #6366f1 60%, #1e1b4b);
  color: #fff;
  font-family: system-ui, sans-serif;
}

.reveal-caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 14px 16px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
  transform: translateY(40%);
  transition: transform 0.3s ease;
}

.reveal-card h3 {
  margin: 0;
  font-size: 17px;
}

.reveal-card p {
  margin: 4px 0 0;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.reveal-card:hover .reveal-caption {
  transform: none;
}

.reveal-card:hover p {
  opacity: 0.85;
}

About this CSS Hover Reveal Card

This CSS Hover Reveal Card is 42 lines of pure CSS (0.8 KB) with no JavaScript and no dependencies. It uses transitions, transforms and linear gradients. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.

CSS features used

Customize it

The colors in this snippet. Search and replace them to match your brand:

  • #38bdf8
  • #6366f1
  • #1e1b4b
  • #fff

How to use this hover reveal card

  1. Copy the HTML and paste it where you want the element to appear.
  2. Copy the CSS into your stylesheet, or inside a <style> tag.
  3. Keep the .reveal-card class name, or rename it in both places. Then tweak colors, sizes and timing to match your design.
  4. Using React or Next.js? Change class to className in the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).

Building with an AI tool?

“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.

Feedback