UNIT 25 • STAGE 2 OF 7
3D flip card HTML and CSS with perspective and backface-visibility
CSS 3D transforms require three layered elements:
.flip-card): sets perspective, which controls how dramatic the 3D effect looks. Think of it as the distance of the viewer from the card..flip-inner): this is what actually rotates. It needs transform-style: preserve-3d so its children are rendered in 3D space, not flattened.position: absolute to stack on top of each other. The back face starts pre-rotated with rotateY(180deg) so it appears face-down. Both need backface-visibility: hidden so they disappear when facing away from the viewer.perspective: 700px: the lower this number, the more dramatic (distorted) the 3D effect. 700px is a subtle, professional-looking depth.transform-style: preserve-3d: without this, child elements are flattened into a 2D plane and the flip effect collapses.backface-visibility: hidden: when a card face is rotated 180 degrees away, this hides it so the viewer cannot see through to the back..flip-back { transform: rotateY(180deg) }: the back face starts pre-rotated 180 degrees. When .flip-inner also rotates 180 degrees, the math works out: 180 + 180 = 360, so the back face appears right-side up.The CSS structure is complete, but no JavaScript has been added. All cards show their front face. In Stage 3, one line of JS per card will make them flip. Notice how the .flip-card.flipped .flip-inner rule is already written; it is just waiting for JavaScript to add the flipped class.
All 16 Lakota word cards are in place with the 3D CSS structure fully built. The flip animation is wired in CSS, ready for Stage 3's JavaScript.