backface-visibility CSS property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2022.

The backface-visibility CSS property sets whether the back face of an element is visible when turned towards the user.

An element's back face is a mirror image of its front face. Though invisible in 2D, the back face can become visible when a transformation causes the element to be rotated in 3D space. (This property has no effect on 2D transforms, which have no perspective.)

Try it

backface-visibility: visible;
backface-visibility: hidden;
<section class="default-example" id="default-example">
  <div id="example-element">
    <div class="face front">1</div>
    <div class="face back">2</div>
    <div class="face right">3</div>
    <div class="face bottom">6</div>
  </div>
</section>
#default-example {
  background: linear-gradient(skyblue, khaki);
}

#example-element {
  width: 100px;
  height: 100px;
  perspective: 550px;
  perspective-origin: 220% 220%;
  transform-style: preserve-3d;
}

.face {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: absolute;
  backface-visibility: inherit;
  background: rgb(0 0 0 / 0.4);
  font-size: 60px;
  color: white;
}

.front {
  transform: translateZ(50px);
}

.back {
  background: rgb(230 0 0);
  color: white;
  transform: rotateY(180deg) translateZ(50px);
}

.right {
  background: rgb(0 0 0 / 0.6);
  transform: rotateY(90deg) translateZ(50px);
}

.bottom {
  background: rgb(0 0 0 / 0.6);
  transform: rotateX(-90deg) translateZ(50px);
}

Syntax

css
/* Keyword values */
backface-visibility: visible;
backface-visibility: hidden;

/* Global values */
backface-visibility: inherit;
backface-visibility: initial;
backface-visibility: revert;
backface-visibility: revert-layer;
backface-visibility: unset;

The backface-visibility property is specified as one of the keywords listed below.

Values

visible

The back face is visible when turned towards the user.

hidden

The back face is hidden, effectively making the element invisible when turned away from the user.

Formal definition

Initial valuevisible
Applies totransformable elements
Inheritedno
Computed valueas specified
Animation typediscrete

Formal syntax

backface-visibility = 
visible |
hidden

Examples

Cube with transparent and opaque faces

This example shows a cube with transparent faces, and one with opaque faces.

HTML

html
<table>
  <thead>
    <tr>
      <th><code>backface-visibility: visible;</code></th>
      <th><code>backface-visibility: hidden;</code></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        <div class="container">
          <div class="cube show-bf">
            <div class="face front">1</div>
            <div class="face back">2</div>
            <div class="face right">3</div>
            <div class="face left">4</div>
            <div class="face top">5</div>
            <div class="face bottom">6</div>
          </div>
        </div>
        <p>
          Since all faces are partially transparent, the back faces (2, 4, 5)
          are visible through the front faces (1, 3, 6).
        </p>
      </td>
      <td>
        <div class="container">
          <div class="cube hide-bf">
            <div class="face front">1</div>
            <div class="face back">2</div>
            <div class="face right">3</div>
            <div class="face left">4</div>
            <div class="face top">5</div>
            <div class="face bottom">6</div>
          </div>
        </div>
        <p>The three back faces (2, 4, 5) are hidden.</p>
      </td>
    </tr>
  </tbody>
</table>

CSS

css
/* Classes that will show or hide the
   three back faces of the "cube" */
.show-bf div {
  backface-visibility: visible;
}

.hide-bf div {
  backface-visibility: hidden;
}

/* Define the container div, the cube div, and a generic face */
.container {
  width: 150px;
  height: 150px;
  margin: 75px 0 0 75px;
  border: none;
}

.cube {
  width: 100%;
  height: 100%;
  perspective: 550px;
  perspective-origin: 150% 150%;
  transform-style: preserve-3d;
}

.face {
  display: block;
  position: absolute;
  width: 100px;
  height: 100px;
  border: none;
  line-height: 100px;
  font-family: sans-serif;
  font-size: 60px;
  color: white;
  text-align: center;
}

/* Define each face based on direction */
.front {
  background: rgb(0 0 0 / 30%);
  transform: translateZ(50px);
}

.back {
  background: lime;
  color: black;
  transform: rotateY(180deg) translateZ(50px);
}

.right {
  background: rgb(196 0 0 / 70%);
  transform: rotateY(90deg) translateZ(50px);
}

.left {
  background: rgb(0 0 196 / 70%);
  transform: rotateY(-90deg) translateZ(50px);
}

.top {
  background: rgb(196 196 0 / 70%);
  transform: rotateX(90deg) translateZ(50px);
}

.bottom {
  background: rgb(196 0 196 / 70%);
  transform: rotateX(-90deg) translateZ(50px);
}

/* Make the table a little nicer */
th,
p,
td {
  background-color: #eeeeee;
  margin: 0px;
  padding: 6px;
  font-family: sans-serif;
  text-align: left;
}

Result

Specifications

Specification
CSS Transforms Module Level 2
# backface-visibility-property

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
backface-visibility
Chrome – Full support
Chrome 12 (Release date: 2011-06-07)
prefix
prefix Implemented with the vendor prefix: -webkit-
Chrome – Full support
Chrome 36 (Release date: 2014-07-16)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
prefix
prefix Implemented with the vendor prefix: -webkit-
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 10 (Release date: 2012-01-31)
prefix
prefix Implemented with the vendor prefix: -moz-
Firefox – Full support
Firefox 49 (Release date: 2016-09-20)
prefix
prefix Implemented with the vendor prefix: -webkit-
Firefox – Full support
Firefox 16 (Release date: 2012-10-09)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
prefix
prefix Implemented with the vendor prefix: -webkit-
Opera – Full support
Opera 23 (Release date: 2014-07-22)
footnote Full support
Safari – Full support
Safari 5.1 (Release date: 2011-07-20)
prefix
prefix Implemented with the vendor prefix: -webkit-
Safari – Full support
Safari 15.4 (Release date: 2022-03-14)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
prefix
prefix Implemented with the vendor prefix: -webkit-
Chrome Android – Full support
Chrome Android 36 (Release date: 2014-07-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 10 (Release date: 2012-01-31)
prefix
prefix Implemented with the vendor prefix: -moz-
Firefox for Android – Full support
Firefox for Android 49 (Release date: 2016-09-20)
prefix
prefix Implemented with the vendor prefix: -webkit-
Firefox for Android – Full support
Firefox for Android 16 (Release date: 2012-10-09)
footnote Full support
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
prefix
prefix Implemented with the vendor prefix: -webkit-
Opera Android – Full support
Opera Android 24 (Release date: 2014-09-10)
footnote Full support
Safari on iOS – Full support
Safari on iOS 5 (Release date: 2011-10-12)
prefix
prefix Implemented with the vendor prefix: -webkit-
Safari on iOS – Full support
Safari on iOS 15.4 (Release date: 2022-03-14)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
prefix
prefix Implemented with the vendor prefix: -webkit-
Samsung Internet – Full support
Samsung Internet 3 (Release date: 2015-04-10)
footnote Full support
WebView Android – Full support
WebView Android 3 (Release date: 2011-02-22)
prefix
prefix Implemented with the vendor prefix: -webkit-
WebView Android – Full support
WebView Android 37 (Release date: 2014-09-03)
footnote Full support
WebView on iOS – Full support
WebView on iOS 5 (Release date: 2011-10-12)
prefix
prefix Implemented with the vendor prefix: -webkit-
WebView on iOS – Full support
WebView on iOS 15.4 (Release date: 2022-03-14)
footnote Full support
hidden
Chrome – Full support
Chrome 12 (Release date: 2011-06-07)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 10 (Release date: 2012-01-31)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 5.1 (Release date: 2011-07-20)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 10 (Release date: 2012-01-31)
footnote Full support
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 5 (Release date: 2011-10-12)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 5 (Release date: 2011-10-12)
footnote Full support
visible
Chrome – Full support
Chrome 12 (Release date: 2011-06-07)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 10 (Release date: 2012-01-31)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 5.1 (Release date: 2011-07-20)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 10 (Release date: 2012-01-31)
footnote Full support
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 5 (Release date: 2011-10-12)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 5 (Release date: 2011-10-12)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Requires a vendor prefix or different name for use.
Has more compatibility info.

See also