Last updated on

The backface-visibility property relates to 3D transforms. With 3D transforms, you can manage to rotate an element so what we think of as the “front” of an element no longer faces the screen. For instance, this would flip an element away from the screen:

.flip {
  transform: rotateY(180deg);
}

It will look as if you picked it up with a spatula and flipped it over like a pancake. That’s because the default for backface-visibility is visible. Instead of it being visible, you could hide it.

.flip {
  transform: rotateY(180deg);
  backface-visibility: hidden;
}

Simple example:

<div class="flip">text</div>

<!-- U NO SEE! -->
<div class="flip hide-back">text</div>
 body {
  padding: 50px;
  font-size: 50px;  
}

.flip {
  -webkit-transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
    
  -webkit-backface-visibility: visible;
  -moz-backface-visibility:    visible;
  -ms-backface-visibility:     visible;
}

.flip.hide-back {
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility:    hidden;
  -ms-backface-visibility:     hidden;
}

Prefixes

Firefox 10+ and IE 10+ support backface-visibility with no prefix. Opera (post Blink, 15+), Chrome, Safari, iOS, and Android all need -webkit-backface-visibility.

Values

  • visible (default) – the element will always be visible even when not facing the screen.
  • hidden – the element is not visible when not facing the screen.
  • inherit – the property will gets its value from the its parent element.
  • initial – sets the property to its default, which is visible.

Browser Support

Chrome Safari Firefox Opera IE Android iOS
12+ 4+ 10+ 15+ 10+ 3.0+ 2.0+

Leave a Reply

Your email address will not be published. Required fields are marked *