Neon Glow Card
This is an interactive card UI component where the edge of the card lights up like a neon light when hovered, and the spotlight moves depending on the mouse position.
Preview
Three cards stand out against a dark background, and when hovered, a neon glow and spotlight effect is activated.
Lightning Fast
Load instantly with edge caching.
Secure by Design
Safe with zero trust security.
Deep Analytics
Real-time insights.
Use cases and features
-
Games/Dashboards/Digital Products: Suitable for dark theme sites.
-
CSS variables plus JavaScript: A simple implementation to update
--mx/--myvariables with JavaScript. -
Control the color of each card with CSS variables: Easily change the emitting color with the
--glowvariable.
Points of design and UX
-
Control the position of
radial-gradientwith the position of the mouse: Achieve spotlight directionality by specifying the position with a CSS variable instead ofbackground-position. -
opacity: 0 → 0.6transition: The glow fades in, so the hover is natural and smooth. -
translateY(-8px)lift-up: The effect of making the cards appear floating emphasizes interactivity.
How to customize
To change the glow color, just override the --glow variable:
/* pink accent */
.neon-card { --glow: #ec4899; }
/* cyan accent */
.neon-card { --glow: #06b6d4; }
Implementation code
<div class="neon-cards-grid">
<div class="neon-card neon-card-1">
<div class="neon-card-content">
<div class="neon-card-icon">⚡</div>
<h3 class="neon-card-title">Lightning Fast</h3>
<p class="neon-card-desc">Load instantly with edge caching.</p>
</div>
</div>
<!-- Similar structure for other cards -->
</div>
<style>
/* Details are the same as CSS in Preview */
.neon-cards-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 2rem;
}
.neon-card {
--glow: #6366f1;
position: relative;
background: #111;
border-radius: 16px;
padding: 2px;
cursor: pointer;
transition: transform 0.3s ease;
overflow: hidden;
}
.neon-card::before {
content: "";
position: absolute;
inset: 0;
background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 50%), var(--glow), transparent 40%);
opacity: 0;
transition: opacity 0.3s ease;
}
.neon-card:hover {
transform: translateY(-8px);
}
.neon-card:hover::before {
opacity: 0.6;
}
.neon-card-content {
position: relative;
background: #111;
border-radius: 14px;
padding: 2rem;
height: 100%;
z-index: 1;
}
.neon-card-1 { --glow: #ec4899; }
.neon-card-2 { --glow: #06b6d4; }
.neon-card-3 { --glow: #8b5cf6; }
</style>
<script>
(function() {
document.querySelectorAll('.neon-card').forEach(function(card) {
card.addEventListener('mousemove', function(e) {
var rect = card.getBoundingClientRect();
card.style.setProperty('--mx', ((e.clientX-rect.left)/rect.width*100)+'%');
card.style.setProperty('--my', ((e.clientY-rect.top)/rect.height*100)+'%');
});
});
})();
</script> Browser compatibility status
| Browser | Compatibility status |
|--------|-------|
| Chrome 49+ | ✅ Fully compatible |
| Firefox 31+ | ✅ Fully compatible |
| Safari 9.1+ | ✅ Compatible |
| Edge 79+ | ✅ Fully compatible |