Skip to content

Image Zoom Mask

A copy-paste cards & hover component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.

Cards & HoverHTMLCSSany framework
Image Zoom Mask
Image zooms within mask

Copy into your project

HTML
<!-- Image Zoom Mask — image zooms within mask on hover -->
<div class="nuda-zoom-mask" tabindex="0">
  <div class="nuda-zoom-mask__media"></div>
  <div class="nuda-zoom-mask__body">
    <h3 class="nuda-zoom-mask__title">Image Zoom Mask</h3>
    <p class="nuda-zoom-mask__desc">Image zooms within the mask on hover</p>
  </div>
</div>
CSS
/* ── Image Zoom Mask ─────────────────────────────────────────
   The overflow:hidden wrapper masks the scaling media.
   Swap the gradient on __media for a real background-image.
   Customize:
     --nuda-zm-scale   : hover zoom factor
     --nuda-zm-speed   : zoom duration
   ──────────────────────────────────────────────────────────── */
.nuda-zoom-mask {
  --nuda-zm-scale: 1.12;
  --nuda-zm-speed: 0.5s;

  width: 280px;
  border-radius: 16px;
  overflow: hidden;
  background: #09090b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.nuda-zoom-mask:focus-visible {
  outline: 2px solid #e4ff54;
  outline-offset: 3px;
}

.nuda-zoom-mask__media {
  height: 160px;
  /* Replace with: background: url('...') center / cover; */
  background-image:
    radial-gradient(circle at 30% 30%, #e4ff54, transparent 45%),
    linear-gradient(135deg, #a3b800, #09090b);
  transform: scale(1);
  transform-origin: center;
  transition: transform var(--nuda-zm-speed) cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.nuda-zoom-mask:hover .nuda-zoom-mask__media,
.nuda-zoom-mask:focus-visible .nuda-zoom-mask__media {
  transform: scale(var(--nuda-zm-scale));
}

.nuda-zoom-mask__body {
  padding: 16px 18px;
  color: #fafafa;
}

.nuda-zoom-mask__title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.nuda-zoom-mask__desc {
  font-size: 0.82rem;
  opacity: 0.6;
  margin: 4px 0 0;
}

/* ── Accessibility ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .nuda-zoom-mask__media { transition: none; }
  .nuda-zoom-mask:hover .nuda-zoom-mask__media,
  .nuda-zoom-mask:focus-visible .nuda-zoom-mask__media { transform: none; }
}

How to use Image Zoom Mask

Paste the HTML where you need it and the CSS into a global stylesheet (or a <style> tag). Every class is prefixed nuda- so it never collides with Tailwind or your own styles. Tweak the CSS custom properties to match your design system.

Works in React, Vue, Svelte, Astro, Next.js, Nuxt, Laravel Blade, Django, Rails — or a single .html file. No npm install, no build step.

More cards & hover components

← Browse all NudaUI components