CSS Product Quick Actions Card

A product tile whose Quick view and Add to cart buttons slide up on hover or keyboard focus.

  • product
  • hover actions
  • quick view
  • add to cart
  • shop
  • focus-within
HTML
<article class="quick-card">
  <div class="quick-card-media">
    <img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 30'%3E%3Crect width='40' height='30' fill='%23fef3c7'/%3E%3Crect x='13' y='9' width='12' height='14' rx='2' fill='%23d97706'/%3E%3Cpath d='M25 12h2a3 3 0 0 1 0 6h-2' fill='none' stroke='%23b45309' stroke-width='2'/%3E%3C/svg%3E" alt="Amber stoneware mug" width="200" height="150">
    <div class="quick-card-actions">
      <button type="button">Quick view</button>
      <button type="button">Add to cart</button>
    </div>
  </div>
  <h3><a href="#">Stoneware Mug</a></h3>
  <p>$24</p>
</article>
CSS
.quick-card {
  width: 200px;
  color: #292524;
  font-family: system-ui, sans-serif;
}

.quick-card-media {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
}

.quick-card-media img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.4s ease;
}

.quick-card-actions {
  position: absolute;
  right: 8px;
  bottom: 8px;
  left: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.quick-card-actions button {
  padding: 8px 4px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: #292524;
  font: 600 12px system-ui, sans-serif;
  cursor: pointer;
}

.quick-card-actions button:last-child {
  background: #292524;
  color: #fff;
}

.quick-card:hover .quick-card-actions,
.quick-card:focus-within .quick-card-actions {
  opacity: 1;
  transform: none;
}

.quick-card:hover img {
  transform: scale(1.05);
}

.quick-card button:focus-visible,
.quick-card a:focus-visible {
  outline: 2px solid #d97706;
  outline-offset: 2px;
}

.quick-card h3 {
  margin: 10px 0 0;
  font-size: 14px;
  font-weight: 600;
}

.quick-card h3 a {
  color: inherit;
  text-decoration: none;
}

.quick-card p {
  margin: 2px 0 0;
  color: #78716c;
  font-size: 14px;
}

@media (hover: none) {
  .quick-card-actions {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .quick-card-media img,
  .quick-card-actions {
    transition: none;
  }
}

About this CSS Product Quick Actions Card

This CSS Product Quick Actions Card is 93 lines of pure CSS (1.5 KB) with no JavaScript and no dependencies. It uses transitions, transforms, CSS Grid and keyboard focus styles. 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:

  • #292524
  • #fff
  • #d97706
  • #78716c

How to use this product quick actions 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 .quick-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