CSS Reference ยท Transforms, Transitions and Animations
The backface-visibility property
Reference for the CSS backface-visibility property: hide the reverse side of a rotated element, build flip cards, with syntax, examples and browser support.
When you rotate an element in 3D far enough, you see its back side. By default the back of an element looks like a mirror image of its front. The backface-visibility property decides whether that back side is drawn (visible) or invisible (hidden).
Its most common use is a flip card: two faces stacked in the same place, each with backface-visibility: hidden, so that only the face pointing toward the viewer shows at any moment.
.face { backface-visibility: hidden; }
Try it
Both panels are turned 160 degrees, so we look at their back. The left one shows the text mirrored; the right one disappears.
The back face is pre-rotated by 180 degrees, so when the whole card turns, it ends up facing the viewer.
Syntax
backface-visibility: visible | hidden
- Initial value:
visible - Applies to: transformable elements
- Inherited: no
- Animatable: no (discrete)
- Computed value: as specified
Values
| Value | Description |
|---|---|
visible |
The back side is drawn, as a mirror image of the front. This is the default. |
hidden |
The element is not drawn while its back side faces the viewer. |
Usage notes
- It only matters in 3D. A normal 2D transform never shows the back of an element. You need a rotation around the X or Y axis (such as
rotateY(180deg)) that turns the element past edge-on. - The element's own back is what counts. The property looks at the element it is set on, not its children. Set it on each face, not only on the card that holds them.
- Keep the faces in the same 3D space. For the flip card, set
transform-style: preserve-3don the wrapper that rotates, andperspectiveon its parent. - Content stays selectable by assistive tools. A hidden back face is only visually hidden. Screen readers may still read both faces, so keep the text order sensible or hide the inactive face from assistive technology when it matters.
- Don't rely on it for security or privacy. It hides pixels, nothing more.
- Respect reduced motion. A flip is a large motion; offer a fade or a simple swap under
prefers-reduced-motion: reduce.
Browser support
Supported in all current browsers. Very old Safari versions needed -webkit-backface-visibility; new code can use the unprefixed property.
Related
perspectiveโ adds depth to a 3D sceneperspective-originโ moves the vanishing pointtransform-styleโ keeps nested elements in 3Dtransformโ rotate, scale, translate and skew- Lessons: 3D Transforms, Transitions