A band of light passes over a solid button, like a reflection sliding across glass. The band is a translucent gradient that only moves on hover.
Also known as: glossy button hover, shimmer button, light sweep.
<button class="hfx-shine-sweep">Upgrade to Pro</button>
.hfx-shine-sweep {
--c: var(--hfx-color, #3b82f6);
font-size: var(--hfx-size, 16px);
display: inline-flex;
align-items: center;
gap: 0.5em;
padding: 0.7em 1.6em;
border-radius: 0.5em;
font: 600 1em system-ui, sans-serif;
cursor: pointer;
position: relative;
overflow: hidden;
border: 0;
background: var(--c);
color: #fff;}
.hfx-shine-sweep::after {
content: "";
position: absolute;
inset: 0;
background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
transform: translateX(-100%);
transition: transform 0.6s ease;
}
.hfx-shine-sweep:hover::after { transform: translateX(100%); }
@media (prefers-reduced-motion: reduce) {
.hfx-shine-sweep, .hfx-shine-sweep *, .hfx-shine-sweep::before, .hfx-shine-sweep::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}The same effect using Tailwind utility classes. No custom CSS or config needed.
<button class="relative overflow-hidden rounded-lg bg-blue-500 px-6 py-3 font-semibold text-white group"> Upgrade to Pro <span class="absolute inset-0 -translate-x-full bg-gradient-to-r from-transparent via-white/40 to-transparent transition-transform duration-500 group-hover:translate-x-full"></span> </button>
--hfx-color on the element or a parent.
Currently previewing #3b82f6.--hfx-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 16px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.