---
title: backface-visibility
slug: Web/CSS/backface-visibility
tags:
  - CSS
  - CSS Property
  - CSS Transforms
  - Reference
  - 'recipe:css-property'
translation_of: Web/CSS/backface-visibility
---
<div>{{CSSRef}}</div>

<p><strong><code>backface-visibility</code></strong> は <a href="/ja/docs/Web/CSS">CSS</a> のプロパティで、要素がユーザーに対して裏側を向いたときに、裏面を可視にするかどうかを設定します。</p>

<div>{{EmbedInteractiveExample("pages/css/backface-visibility.html")}}</div>

<p class="hidden">このデモのソースファイルは GitHub リポジトリに格納されています。デモプロジェクトに協力したい場合は、 <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> をクローンしてプルリクエストを送信してください。</p>

<p>要素の裏面は表面の鏡像です。裏面は二次元では可視ではありませんが、三次元空間で要素に回転の変換が行われたときに、背面を見ることができます。 (このプロパティは、遠近感を持たない二次元の変換では効果がありません。)</p>

<h2 id="Syntax" name="Syntax">構文</h2>

<pre class="brush:css no-line-numbers notranslate">/* キーワード値 */
backface-visibility: visible;
backface-visibility: hidden;

/* グローバル値 */
backface-visibility: inherit;
backface-visibility: initial;
backface-visibility: unset;</pre>

<p><code>backface-visibility</code> プロパティは、以下に挙げたキーワードのうちの一つで指定します。</p>

<h3 id="Values" name="Values">値</h3>

<dl>
 <dt><code>visible</code></dt>
 <dd>ユーザーに対して裏を向いたとき、背面が可視になります。</dd>
 <dt><code>hidden</code></dt>
 <dd>背面が非表示になり、要素がユーザーに対して反対を向いたときに不可視にするのに便利です。</dd>
</dl>

<h2 id="Formal_definition" name="Formal_definition">公式定義</h2>

<p>{{cssinfo}}</p>

<h2 id="Formal_syntax" name="Formal_syntax">形式文法</h2>

{{csssyntax}}

<h2 id="Examples" name="Examples">例</h2>

<h3 id="Cube_with_transparent_and_opaque_faces" name="Cube_with_transparent_and_opaque_faces">透明な面と不透明な面を持った立方体</h3>

<p>この例は、透明な面と不透明な面を持つ立方体を表示します。</p>

<h4 id="HTML">HTML</h4>

<pre class="brush: html notranslate">&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;&lt;code&gt;backface-visibility: visible;&lt;/code&gt;&lt;/th&gt;
    &lt;th&gt;&lt;code&gt;backface-visibility: hidden;&lt;/code&gt;&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;
      &lt;div class="container"&gt;
        &lt;div class="cube showbf"&gt;
          &lt;div class="face front"&gt;1&lt;/div&gt;
          &lt;div class="face back"&gt;2&lt;/div&gt;
          &lt;div class="face right"&gt;3&lt;/div&gt;
          &lt;div class="face left"&gt;4&lt;/div&gt;
          &lt;div class="face top"&gt;5&lt;/div&gt;
          &lt;div class="face bottom"&gt;6&lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;
        すべての面が透明であり、
        裏面 (2, 4, 5) が 表面 (1, 3, 6) を通して表示されます。
      &lt;/p&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;div class="container"&gt;
        &lt;div class="cube hidebf"&gt;
          &lt;div class="face front"&gt;1&lt;/div&gt;
          &lt;div class="face back"&gt;2&lt;/div&gt;
          &lt;div class="face right"&gt;3&lt;/div&gt;
          &lt;div class="face left"&gt;4&lt;/div&gt;
          &lt;div class="face top"&gt;5&lt;/div&gt;
          &lt;div class="face bottom"&gt;6&lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;
        背後の3面 (2, 4, 5) は非表示です。
      &lt;/p&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;</pre>

<h4 id="CSS">CSS</h4>

<pre class="brush: css notranslate">/* Classes that will show or hide the
   three back faces of the "cube" */
.showbf div {
  backface-visibility: visible;
}

.hidebf div {
  backface-visibility: hidden;
}

/* コンテナ div、立方体 div、面の一般的な設定 */
.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;
}

/* 方向に基づいてそれぞれの面を設定 */
.front {
  background: rgba(0, 0, 0, 0.3);
  transform: translateZ(50px);
}

.back {
  background: rgba(0, 255, 0, 1);
  color: black;
  transform: rotateY(180deg) translateZ(50px);
}

.right {
  background: rgba(196, 0, 0, 0.7);
  transform: rotateY(90deg) translateZ(50px);
}

.left {
  background: rgba(0, 0, 196, 0.7);
  transform: rotateY(-90deg) translateZ(50px);
}

.top {
  background: rgba(196, 196, 0, 0.7);
  transform: rotateX(90deg) translateZ(50px);
}

.bottom {
  background: rgba(196, 0, 196, 0.7);
  transform: rotateX(-90deg) translateZ(50px);
}

/* テーブルの見栄えをよくする */
th, p, td {
  background-color: #EEEEEE;
  margin: 0px;
  padding: 6px;
  font-family: sans-serif;
  text-align: left;
}</pre>

<h4 id="Result" name="Result">結果</h4>

<p>{{EmbedLiveSample('Cube_with_transparent_and_opaque_faces', '100%', 360)}}</p>

<h2 id="Specifications" name="Specifications">仕様書</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">仕様書</th>
   <th scope="col">状態</th>
   <th scope="col">備考</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('CSS Transforms 2', '#propdef-backface-visibility', 'backface-visibility')}}</td>
   <td>{{Spec2('CSS Transforms 2')}}</td>
   <td>初回定義</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>

<p>{{Compat("css.properties.backface-visibility")}}</p>

<h2 id="See_also" name="See_also">関連情報</h2>

<ul>
 <li><a href="/ja/docs/Web/CSS/CSS_Transforms/Using_CSS_transforms">CSS 変形の使用</a></li>
</ul>