CSS 3D Flip Button
A button that flips over in 3D on hover to show a second label on its back face.
HTML
<button class="btn-flip">
<span class="btn-flip-front">Get started</span>
<span class="btn-flip-back" aria-hidden="true">Let’s go →</span>
</button>
CSS
.btn-flip {
position: relative;
padding: 0;
border: 0;
border-radius: 12px;
background: none;
font: 600 16px/1 system-ui, sans-serif;
cursor: pointer;
perspective: 600px;
}
.btn-flip-front,
.btn-flip-back {
display: grid;
place-items: center;
padding: 15px 34px;
border-radius: 12px;
color: #fff;
backface-visibility: hidden;
-webkit-backface-visibility: hidden;
transition: transform 0.5s ease;
}
.btn-flip-front {
background: #4f46e5;
}
.btn-flip-back {
position: absolute;
inset: 0;
padding: 0;
background: #0f172a;
transform: rotateX(-180deg);
}
.btn-flip:hover .btn-flip-front,
.btn-flip:focus-visible .btn-flip-front {
transform: rotateX(180deg);
}
.btn-flip:hover .btn-flip-back,
.btn-flip:focus-visible .btn-flip-back {
transform: rotateX(0);
}
.btn-flip:focus-visible {
outline: 3px solid #4f46e5;
outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
.btn-flip-front,
.btn-flip-back { transition: none; }
}
About this CSS 3D Flip Button
This CSS 3D Flip Button is 54 lines of pure CSS (1.0 KB) with no JavaScript and no dependencies. It uses transitions, 3D transforms, transforms and CSS Grid. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.
CSS features used
Customize it
The colors in this snippet. Search and replace them to match your brand:
#fff#4f46e5#0f172a
How to use this 3d flip button
- Copy the HTML and paste it where you want the element to appear.
- Copy the CSS into your stylesheet, or inside a
<style>tag. - Keep the
.btn-flipclass name, or rename it in both places. Then tweak colors, sizes and timing to match your design. - Using React or Next.js? Change
classtoclassNamein the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).
Building with an AI tool?
“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.