Live preview · fully interactive
The prompt
Build a hover flip card. ## Look Scene width min(300px, 100% - 32px), height 180px, perspective 800px. Front face #14141c, back face #1b1630 with text #c4b5fd. Radius 16px, border 1px #23232e. Page #08080d. ## Behavior On hover or focus-within, rotateY the card to 180deg. The back face is pre-rotated 180deg. Use backface-visibility hidden. ## Design tokens - Front #14141c; back #1b1630; accent text #c4b5fd; border #23232e; page #08080d. ## Motion - Transition 0.6s, easing cubic-bezier(0.16, 1, 0.3, 1). ## 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; } .scene { width: min(300px, calc(100% - 32px)); height: 180px; perspective: 800px; } .card { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); } .scene:hover .card, .scene:focus-within .card { transform: rotateY(180deg); } .face { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 16px; backface-visibility: hidden; border: 1px solid #23232e; padding: 16px; text-align: center; } .front { background: #14141c; } .back { background: #1b1630; transform: rotateY(180deg); color: #c4b5fd; }
@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="scene"><div class="card"><div class="face front">Front of the brief</div><div class="face back">The prompt lives here</div></div></div></main>
<script>
</script>
</body>
</html>About this effect
A 3D rotateY of 180 degrees over 0.6s reveals the back face. Both faces are type only, no images.