mozilla

Revision 329181 of backface-visibility

  • Revision slug: CSS/backface-visibility
  • Revision title: backface-visibility
  • Revision id: 329181
  • Created:
  • Creator: enderandpeter
  • Is current revision? No
  • Comment Cleaned up sentence in backface-visibility: hidden; example

Revision Content

{{ CSSRef() }}

{{ SeeCompatTable() }}

Summary

The CSS backface-visibility property determines whether or not the back face of the element is visible when facing the user. The back face of an element always is a transparent background, letting, when visible, a mirror image of the front face be displayed.

There are cases when we do not want the front face of an element to be visible through the back face, like when doing a flipping card effect (setting two elements side-to-side).

This property has no effect on 2D transforms as there is no perspective.

  • {{ Xref_cssinitial() }} visible
  • Applies to any transformable element
  • {{ Xref_cssinherited() }} no
  • Media {{ Xref_cssvisual() }}
  • {{ Xref_csscomputed() }} {{ Xref_cssspecifiedkeyword() }}
  • {{ xref_cssanimatable() }} ?
  • {{ xref_csscanonicalorder() }} the unique non-ambiguous order defined by the formal grammar

Syntax

Formal grammar: visible | hidden 
backface-visibility: visibility

backface-visibility: visible
backface-visibility: hidden

Values

visibility
Is a keyword indicating if the backface must be visible or not. It can have the following values:
  • visible meaning that the back face is visible, allowing the front face to be displayed mirrored;
  • hidden meaning that the back face is not visible, hiding the front face.

Examples

backface-visibility: visible; backface-visibility: hidden;
1
2
3
4
5
6
1
2
3
4
5
6

Though not opaque, the front sides don't allow the
back faces of the hidden sides to be displayed.

Specifications

Specification Status Comment
{{ SpecName('CSS3 Transforms', '#backface-visibility-property', 'backface-visibility') }} {{ Spec2('CSS3 Transforms') }}  

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 12{{ property_prefix('-webkit') }} {{ CompatGeckoDesktop("10") }}{{ property_prefix('-moz') }}
{{ CompatGeckoDesktop("16") }}
10 {{ CompatNo() }} {{ CompatVersionUnknown() }}{{ property_prefix('-webkit') }}
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support 3.0{{ property_prefix('-webkit') }} {{ CompatGeckoMobile("10") }}{{ property_prefix('-moz') }}
{{ CompatGeckoMobile("16") }}
{{ CompatUnknown() }} {{ CompatNo() }} {{ CompatVersionUnknown() }}{{ property_prefix('-webkit') }}

See also

Revision Source

<p>{{ CSSRef() }}</p>
<p>{{ SeeCompatTable() }}</p>
<h2 id="Summary">Summary</h2>
<p>The <a href="/en/CSS" title="CSS">CSS</a> <code>backface-visibility</code> property determines whether or not the back face of the element is visible when facing the user. The back face of an element always is a transparent background, letting, when visible, a mirror image of the front face be displayed.</p>
<p>There are cases when we do not want the front face of an element to be visible through the back face, like when doing a flipping card effect (setting two elements side-to-side).</p>
<p>This property has no effect on 2D transforms as there is no perspective.</p>
<ul class="cssprop">
  <li><dfn>{{ Xref_cssinitial() }} </dfn> <code>visible</code></li>
  <li><dfn>Applies to </dfn> any transformable element</li>
  <li><dfn>{{ Xref_cssinherited() }}</dfn> no</li>
  <li><dfn>Media</dfn> {{ Xref_cssvisual() }}</li>
  <li><dfn>{{ Xref_csscomputed() }}</dfn> {{ Xref_cssspecifiedkeyword() }}</li>
  <li><dfn>{{ xref_cssanimatable() }}</dfn> ?</li>
  <li><dfn>{{ xref_csscanonicalorder() }}</dfn> the unique non-ambiguous order defined by the formal grammar</li>
</ul>
<h2 id="Syntax" name="Syntax">Syntax</h2>
<pre class="twopartsyntaxbox">
Formal grammar: visible | hidden 
</pre>
<pre>
backface-visibility: <em>visibility</em>

backface-visibility: visible
backface-visibility: hidden
</pre>
<h3 id="Values">Values</h3>
<dl>
  <dt>
    <em>visibility</em></dt>
  <dd>
    Is a keyword indicating if the backface must be visible or not. It can have the following values:
    <ul>
      <li style="margin-left: 40px;"><code>visible</code> meaning that the back face is visible, allowing the front face to be displayed mirrored;</li>
      <li style="margin-left: 40px;"><code>hidden</code> meaning that the back face is not visible, hiding the front face.</li>
    </ul>
  </dd>
</dl>
<h2 id="Examples" name="Examples">Examples</h2>
<table class="standard-table">
  <tbody>
    <tr>
      <td><code>backface-visibility: visible;</code></td>
      <td><code>backface-visibility: hidden;</code></td>
    </tr>
    <tr>
      <td>
        <div class="container" style="width:200px;height:200px;margin:75px 0 0 75px;border:none;">
          <div class="cube" style="width:100%;height:100%;-moz-perspective:300px;-moz-transform-style:preserve-3d;-moz-perspective-origin:150% 150%;-moz-backface-visibility:visible;-webkit-perspective:300px;-webkit-transform-style:preserve-3d;-webkit-perspective-origin:150% 150%;-webkit-backface-visibility:visible;">
            <div class="front" style="display: block;position: absolute;width: 100px;height: 100px;border: none;line-height: 100px;font-family: arial, sans-serif;font-size: 60px;color: white;text-align: center;background: rgba(   0, 0, 0, 0.3 );-moz-transform: translateZ( 50px );-moz-backface-visibility:visible;-webkit-transform: translateZ( 50px );-webkit-backface-visibility:visible;">
              1</div>
            <div class="back" style="display: block;position: absolute;width: 100px;height: 100px;border: none;line-height: 100px;font-family: arial, sans-serif;font-size: 60px;color: white;text-align: center;background: rgba(   0, 255,   0, 1 ); color: black;-moz-transform:  rotateY(180deg)  translateZ( 50px );-moz-backface-visibility:visible;-webkit-transform:  rotateY(180deg)  translateZ( 50px );-webkit-backface-visibility:visible;">
              2</div>
            <div class="right" style="display: block;position: absolute;width: 100px;height: 100px;border: none;line-height: 100px;font-family: arial, sans-serif;font-size: 60px;color: white;text-align: center;background: rgba( 196,   0,   0, 0.7 );-moz-transform: rotateY( 90deg) translateZ( 50px );-moz-backface-visibility:visible;-webkit-transform: rotateY( 90deg) translateZ( 50px );-webkit-backface-visibility:visible;">
              3</div>
            <div class="left" style="display: block;position: absolute;width: 100px;height: 100px;border: none;line-height: 100px;font-family: arial, sans-serif;font-size: 60px;color: white;text-align: center;background: rgba(   0,   0, 196, 0.7 );-moz-transform: rotateY(-90deg) translateZ( 50px );-moz-backface-visibility:visible;-webkit-transform: rotateY(-90deg) translateZ( 50px );-webkit-backface-visibility:visible;">
              4</div>
            <div class="top" style="display: block;position: absolute;width: 100px;height: 100px;border: none;line-height: 100px;font-family: arial, sans-serif;font-size: 60px;color: white;text-align: center;background: rgba( 196, 196,   0, 0.7 );-moz-transform: rotateX( 90deg) translateZ( 50px );-moz-backface-visibility:visible;-webkit-transform: rotateX( 90deg) translateZ( 50px );-webkit-backface-visibility:visible;">
              5</div>
            <div class="bottom" style="display: block;position: absolute;width: 100px;height: 100px;border: none;line-height: 100px;font-family: arial, sans-serif;font-size: 60px;color: white;text-align: center;background: rgba( 196,   0, 196, 0.7);-moz-transform: rotateX(-90deg) translateZ( 50px );-moz-backface-visibility:visible;-webkit-transform: rotateX(-90deg) translateZ( 50px );-webkit-backface-visibility:visible;">
              6</div>
          </div>
        </div>
      </td>
      <td>
        <div class="container" style="width:200px;height:200px;margin:75px 0 0 75px;border:none;">
          <div class="cube" style="width:100%;height:100%;-moz-perspective:300px;-moz-transform-style:preserve-3d;-moz-perspective-origin:150% 150%;-webkit-perspective:300px;-webkit-transform-style:preserve-3d;-webkit-perspective-origin:150% 150%;">
            <div class="front" style="display: block;position: absolute;width: 100px;height: 100px;border: none;line-height: 100px;font-family: arial, sans-serif;font-size: 60px;color: white;text-align: center;background: rgba(   0, 0, 0, 0.3 );-moz-transform: translateZ( 50px );-moz-backface-visibility:hidden;-webkit-transform: translateZ( 50px );-webkit-backface-visibility:hidden;">
              1</div>
            <div class="back" style="display: block;position: absolute;width: 100px;height: 100px;border: none;line-height: 100px;font-family: arial, sans-serif;font-size: 60px;color: white;text-align: center;background: rgba(   0, 255,   0, 1 ); color: black;-moz-transform:  rotateY(180deg)  translateZ( 50px );-moz-backface-visibility:hidden;-webkit-transform:  rotateY(180deg)  translateZ( 50px );-webkit-backface-visibility:hidden;">
              2</div>
            <div class="right" style="display: block;position: absolute;width: 100px;height: 100px;border: none;line-height: 100px;font-family: arial, sans-serif;font-size: 60px;color: white;text-align: center;background: rgba( 196,   0,   0, 0.7 );-moz-transform: rotateY( 90deg) translateZ( 50px );-moz-backface-visibility:hidden;-webkit-transform: rotateY( 90deg) translateZ( 50px );-webkit-backface-visibility:hidden;">
              3</div>
            <div class="left" style="display: block;position: absolute;width: 100px;height: 100px;border: none;line-height: 100px;font-family: arial, sans-serif;font-size: 60px;color: white;text-align: center;background: rgba(   0,   0, 196, 0.7 );-moz-transform: rotateY(-90deg) translateZ( 50px );-moz-backface-visibility:hidden;-webkit-transform: rotateY(-90deg) translateZ( 50px );-webkit-backface-visibility:hidden;">
              4</div>
            <div class="top" style="display: block;position: absolute;width: 100px;height: 100px;border: none;line-height: 100px;font-family: arial, sans-serif;font-size: 60px;color: white;text-align: center;background: rgba( 196, 196,   0, 0.7 );-moz-transform: rotateX( 90deg) translateZ( 50px );-moz-backface-visibility:hidden;-webkit-transform: rotateX( 90deg) translateZ( 50px );-webkit-backface-visibility:hidden;">
              5</div>
            <div class="bottom" style="display: block;position: absolute;width: 100px;height: 100px;border: none;line-height: 100px;font-family: arial, sans-serif;font-size: 60px;color: white;text-align: center;background: rgba( 196,   0, 196, 0.7);-moz-transform: rotateX(-90deg) translateZ( 50px );-moz-backface-visibility:hidden;-webkit-transform: rotateX(-90deg) translateZ( 50px );-webkit-backface-visibility:hidden;">
              6</div>
          </div>
        </div>
        <p>Though not opaque, the front sides don't allow the<br />
          back faces of the hidden sides to be displayed.</p>
      </td>
    </tr>
  </tbody>
</table>
<h2 id="Specifications" name="Specifications">Specifications</h2>
<table class="standard-table">
  <thead>
    <tr>
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>{{ SpecName('CSS3 Transforms', '#backface-visibility-property', 'backface-visibility') }}</td>
      <td>{{ Spec2('CSS3 Transforms') }}</td>
      <td>&nbsp;</td>
    </tr>
  </tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Chrome</th>
        <th>Firefox (Gecko)</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari (WebKit)</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>12{{ property_prefix('-webkit') }}</td>
        <td>{{ CompatGeckoDesktop("10") }}{{ property_prefix('-moz') }}<br />
          {{ CompatGeckoDesktop("16") }}</td>
        <td>10</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatVersionUnknown() }}{{ property_prefix('-webkit') }}</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Android</th>
        <th>Firefox Mobile (Gecko)</th>
        <th>IE&nbsp;Phone</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>3.0{{ property_prefix('-webkit') }}</td>
        <td>{{ CompatGeckoMobile("10") }}{{ property_prefix('-moz') }}<br />
          {{ CompatGeckoMobile("16") }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatVersionUnknown() }}{{ property_prefix('-webkit') }}</td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="See_also" name="See_also">See also</h2>
<ul>
  <li><a href="/en-US/docs/CSS/Using_CSS_transforms" title="/en-US/docs/CSS/Using_CSS_transforms">Using CSS Transforms</a></li>
  <li>{{ CSS_Reference:Transforms() }}</li>
</ul>
Revert to this revision