Holographic Foil
全息镭射箔
Fine foil ridges, a spectral gradient, and a bright reflection combine to make a printed surface look iridescent.
Where to use it
Apply a distinctive finish to a collectible, membership card, or premium product label. Confine the reflection to the decorative artwork so that serial numbers, names, and other text remain legible as the angle changes.
Practical example
A concert archive displays a digital commemorative ticket. Changing the viewing angle sends a narrow rainbow highlight across the foil emblem while the date and seat number stay on a matte field.
AI prompt
Add Holographic Foil to [target artwork]. Isolate the card, layer a fine repeating gradient over a wide spectral band, and mask the reflection to the artwork. Position the reflection with a CSS custom property. Provide a readable fixed-angle default and a usable angle control for touch and keyboard. Keep labels on a separate high-contrast layer.
Example code
Save the standalone HTML as a file and open it in your browser. It uses the same code as the preview.
View HTML
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Holographic Foil</title>
<style>
:root {
color-scheme: dark;
--demo-bg: #171629;
--demo-ink: #f8f5ff;
--demo-accent: #b9a6ff;
--demo-muted: #bfbbd3;
font-family: system-ui, sans-serif;
color: var(--demo-ink);
background: var(--demo-bg);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
button, input { font: inherit; }
.demo {
display: grid;
place-items: center;
align-content: center;
min-height: 100vh;
padding: 14px;
overflow: hidden;
background: radial-gradient(ellipse at 50% 24%, #28233f, var(--demo-bg) 78%);
}
.demo-button {
border: 1px solid #ffffff3d;
border-radius: 7px;
background: #ffffff12;
color: var(--demo-ink);
padding: 6px 11px;
font-size: 12px;
cursor: pointer;
}
:focus-visible {
outline: 2px solid var(--demo-accent);
outline-offset: 3px;
}
.foil-demo {
width: min(100%, 288px);
display: grid;
gap: 11px;
}
.foil-card {
--foil-angle: 146deg;
position: relative;
isolation: isolate;
display: grid;
align-items: end;
min-height: clamp(98px, 56vh, 165px);
margin: 0;
padding: 10px 12px;
overflow: hidden;
border: 1px solid #b1c4df70;
border-radius: 13px;
background: linear-gradient(138deg, #2b3856, #111a29 60%, #222343);
box-shadow: 0 10px 18px #090a17a0, inset 0 0 0 4px #181e3870;
}
.foil-film {
position: absolute;
inset: 4px;
border-radius: 9px;
background:
repeating-linear-gradient(132deg, #fff8 0 1px, #0002 1px 3px),
linear-gradient(var(--foil-angle), #524bf5 2%, #83e8ff 22%, #eeffac 38%, #ffabce 55%, #8f5cf2 74%, #aaffeb 100%);
background-blend-mode: overlay, normal;
mix-blend-mode: screen;
mask-image: radial-gradient(ellipse at 66% 35%, #000 18%, #000c 58%, transparent 100%);
opacity: .76;
}
.foil-prism {
position: absolute;
top: 15%;
right: 18%;
width: clamp(48px, 31vh, 94px);
aspect-ratio: 1;
border: 1px solid #f8f4feb5;
transform: rotate(45deg);
background: repeating-linear-gradient(
0deg, transparent 0 4px, #17162e 5px 6px, transparent 7px 10px
);
box-shadow: 0 0 14px #d1bdfe50, inset 0 0 18px #fff4;
}
.foil-card figcaption {
width: max-content;
position: relative;
max-width: 100%;
padding: 3px 6px;
border-radius: 4px;
background: #151a2e;
color: #fff;
font-size: 13px;
font-weight: 720;
}
.foil-control {
display: grid;
grid-template-columns: auto minmax(0, 1fr) 4ch;
align-items: center;
gap: 9px;
color: var(--demo-ink);
font-size: 12px;
}
.foil-control input {
width: 100%;
margin: 0;
accent-color: #aee5f4;
}
.foil-degrees {
text-align: end;
color: var(--demo-muted);
font-variant-numeric: tabular-nums;
}
@media (forced-colors: active) {
.foil-film { display: none; }
.foil-card, .foil-prism { border-color: CanvasText; }
}
</style>
</head>
<body>
<main class="demo">
<div class="foil-demo">
<figure class="foil-card">
<span class="foil-film" aria-hidden="true"></span>
<span class="foil-prism" aria-hidden="true"></span>
<figcaption>Arc Light</figcaption>
</figure>
<label class="foil-control">
<span>Angle</span>
<input type="range" min="0" max="360" step="1" value="146">
<span class="foil-degrees" aria-hidden="true">146°</span>
</label>
</div>
</main>
<script>
const card = document.querySelector('.foil-card');
const input = document.querySelector('.foil-control input');
const degrees = document.querySelector('.foil-degrees');
input.addEventListener('input', () => {
const angle = input.value + '°';
card.style.setProperty('--foil-angle', input.value + 'deg');
degrees.textContent = angle;
input.setAttribute('aria-valuetext', angle);
});
</script>
</body>
</html>Original example by UI Skills