Card Hover Effect

Modern card with 3D tilt and glow effect on hover.

Advanced card hover effect with 3D tilt, animated gradient border, glow shadow, and smooth transitions. Includes both vanilla CSS and Tailwind CSS versions.
card-hover.csscss
.card-3d {
  position: relative;
  width: 100%;
  max-width: 350px;
  height: 400px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 20px;
  padding: 32px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  perspective: 1000px;
}

.card-3d::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0));
  opacity: 0;
  transition: opacity 0.3s;
}

.card-3d::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 20px;
  background: linear-gradient(45deg, #667eea, #764ba2, #f093fb, #4facfe);
  background-size: 300% 300%;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s;
  animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.card-3d:hover {
  transform: translateY(-10px) rotateX(5deg) rotateY(5deg);
  box-shadow: 
    0 20px 40px rgba(102, 126, 234, 0.4),
    0 0 60px rgba(118, 75, 162, 0.3);
}

.card-3d:hover::before {
  opacity: 1;
}

.card-3d:hover::after {
  opacity: 1;
}

.card-3d-content {
  position: relative;
  z-index: 1;
  color: white;
  transform: translateZ(50px);
}

.card-3d-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
}

.card-3d-description {
  font-size: 14px;
  line-height: 1.6;
  opacity: 0.9;
}

/* Tailwind Alternative */
@layer components {
  .card-hover-glow {
    @apply relative overflow-hidden rounded-2xl bg-gradient-to-br from-purple-500 to-pink-500 p-8;
    @apply transition-all duration-300 hover:-translate-y-2;
    @apply hover:shadow-[0_20px_50px_rgba(139,92,246,0.4)];
  }
  
  .card-hover-glow::before {
    @apply content-[''] absolute inset-0 bg-gradient-to-br from-white/20 to-transparent;
    @apply opacity-0 transition-opacity duration-300;
  }
  
  .card-hover-glow:hover::before {
    @apply opacity-100;
  }
}

Usage

Apply .card-3d class to card element or use Tailwind's .card-hover-glow

Let’s Build Something You’ll Be Proud Of

No fluff. Just thoughtful design and reliable development.

Work with me
Average response time: within 24 hours