CSS3 backface-visibility
Property
Topic: CSS3 Properties ReferencePrev|Next
Description
The backface-visibility
CSS property determines whether or not the "back" side of a transformed element is visible when facing the user.
The following table summarizes the usages context and the version history of this property.
Default value: | visible |
---|---|
Applies to: | Transformable elements |
Inherited: | No |
Animatable: | No. See animatable properties. |
Version: | New in CSS3 |
Syntax
The syntax of the property is given with:
The example below shows the backface-visibility
property in action.
.flip-container {
margin: 50px;
perspective: 1000px;
display: inline-block;
}
.flip-container:hover .card {
transform: rotateY(180deg);
}
.card, .front, .back {
width: 130px;
height: 195px;
}
.card {
position: relative;
transition: 0.5s all;
transform-style: preserve-3d;
}
.front, .back {
position: absolute;
backface-visibility: hidden;
}
.front {
z-index: 1;
transform: rotateY(180deg);
}
.back {
z-index: 2;
transform: rotateY(0deg);
}
Note: The backface-visibility
property is very useful for creating animations like revolving coin or card flipping, where two different images (i.e. front and back side) are blend together to create better 3D rotation effect.
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
visible |
Specifies that the back face is visible, allowing the front face to be displayed mirrored. This is default value. |
hidden |
Specifies that the back face is not visible, hiding the front face. |
initial |
Sets this property to its default value. |
inherit |
If specified, the associated element takes the computed value of its parent element backface-visibility property. |
Browser Compatibility
The backface-visibility
property is supported in all major modern browsers.
Basic Support—
|
Further Reading
See tutorial on: CSS3 Transitions, CSS3 3D Transforms, CSS3 Animations.
Related properties: perspective
, perspective-origin
, transform
, transform-origin
, transform-style
, transition
.