Live preview · fully interactive
The prompt
Build a card with a traveling border beam. ## Look Wrapper width min(320px, 100% - 32px), height 180px, radius 18px, padding 1px, overflow hidden. Inner card #101018, radius 17px, text #f2f2f7. The beam is a conic gradient that is transparent until 75%, then #c4b5fd at 88%. Page #08080d. ## Behavior Rotate the gradient 360deg. It must be larger than the card so the edge stays even. ## Design tokens - Beam #c4b5fd; card #101018; page #08080d. ## Motion - Duration 4s, linear, infinite. ## Constraints - Single self-contained HTML file. No libraries. CSS only. - Honor prefers-reduced-motion: reduce by skipping the loop and leaving a readable static frame - Readable at 390px width with no horizontal page scroll
The code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { min-height: 100%; }
body {
background: #08080d; color: #f2f2f7; font-family: Inter, system-ui, sans-serif;
min-height: 100vh; overflow: hidden;
}
.hint { position: absolute; left: 16px; top: 16px; z-index: 5; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: #8a8a99; }
main { min-height: 100vh; display: grid; place-items: center; } .wrap { width: min(320px, calc(100% - 32px)); height: 180px; border-radius: 18px; padding: 1px; position: relative; overflow: hidden; } .spin { position: absolute; inset: -40%; background: conic-gradient(from 0deg, transparent 0 75%, #c4b5fd 88%, transparent 100%); animation: spin 4s linear infinite; } .card { position: relative; height: 100%; border-radius: 17px; background: #101018; display: grid; place-items: center; } @keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 420px) {
.hint { font-size: 10px; letter-spacing: 0.08em; }
}
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
</style>
</head>
<body>
<main><div class="wrap"><div class="spin"></div><div class="card">Beam</div></div></main>
<script>
</script>
</body>
</html>About this effect
A conic gradient spins behind a padded mask so only a 1px beam is visible around the card. The loop is 4s linear.