A pastel foil button whose colors shift like a hologram tilted in the light, with a fine crosshatch texture and a glare band that swings across. The loops run alternate, so there is never a jump.
Also known as: holographic effect css, iridescent button css, holo foil button.
<button class="btn-holographic" type="button">Mint your pass</button>
.btn-holographic {
--c: var(--btn-color, #3b82f6);
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5em;
padding: 0.75em 1.6em;
border: 0;
border-radius: 0.6em;
font: 600 var(--btn-size, 18px)/1.1 system-ui, sans-serif;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
position: relative;
isolation: isolate;
overflow: hidden;
padding: 0.85em 2em;
border-radius: 0.8em;
background: linear-gradient(115deg,
color-mix(in srgb, var(--c) 30%, #ffc4ee),
color-mix(in srgb, var(--c) 25%, #b9f3ff),
color-mix(in srgb, var(--c) 20%, #fff3b0),
color-mix(in srgb, var(--c) 30%, #d4c6ff),
color-mix(in srgb, var(--c) 30%, #ffc4ee),
color-mix(in srgb, var(--c) 25%, #b9f3ff)) 0 50% / 300% 100%;
color: color-mix(in srgb, var(--c) 40%, #1e1b4b);
box-shadow:
inset 0 0 0 1px rgba(255, 255, 255, 0.75),
0 0.35em 0.9em -0.3em color-mix(in srgb, var(--c) 40%, rgba(76, 29, 149, 0.5));
animation: btn-holographic-shift 5s ease-in-out infinite alternate;
transition: transform 0.2s ease;}
.btn-holographic::before {
content: "";
position: absolute;
inset: 0;
z-index: -1;
background:
repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.28) 0 1px, transparent 1px 0.3em),
repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.2) 0 1px, transparent 1px 0.3em);
}
.btn-holographic::after {
content: "";
position: absolute;
top: -50%;
bottom: -50%;
left: -30%;
z-index: -1;
width: 160%;
background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.75) 50%, transparent 62%);
transform: translateX(-25%);
animation: btn-holographic-glare 5s ease-in-out infinite alternate;
}
.btn-holographic:active { transform: scale(0.97); }
@keyframes btn-holographic-shift {
to { background-position: 100% 50%; }
}
@keyframes btn-holographic-glare {
to { transform: translateX(25%); }
}
@media (prefers-reduced-motion: reduce) {
.btn-holographic, .btn-holographic *, .btn-holographic::before, .btn-holographic::after, .btn-holographic *::before, .btn-holographic *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}--btn-color on the element or a parent.
Currently previewing #3b82f6.--btn-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 18px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.