diff options
Diffstat (limited to 'files/ja/web/css/z-index/index.html')
-rw-r--r-- | files/ja/web/css/z-index/index.html | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/files/ja/web/css/z-index/index.html b/files/ja/web/css/z-index/index.html new file mode 100644 index 0000000000..e5e6ec70b0 --- /dev/null +++ b/files/ja/web/css/z-index/index.html @@ -0,0 +1,139 @@ +--- +title: z-index +slug: Web/CSS/z-index +tags: + - CSS + - CSS プロパティ + - CSS 位置指定レイアウト + - Reference +translation_of: Web/CSS/z-index +--- +<div>{{CSSRef}}</div> + +<p>CSS の <strong><code>z-index</code></strong> プロパティは、<a href="/ja/docs/Web/CSS/position">位置指定</a>要素とその子孫要素、またはフレックスアイテムの z 順を定義します。より大きな z-index を持つ要素はより小さな要素の上に重なります。</p> + +<div>{{EmbedInteractiveExample("pages/css/z-index.html")}}</div> + +<p class="hidden">このデモのソースファイルは GitHub リポジトリに格納されています。デモプロジェクトに協力したい場合は、 <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> をクローンしてプルリクエストを送信してください。</p> + +<p>位置指定されたボックス (つまり、 <code>position</code> が <code>static</code> 以外のもの) では、 <code>z-index</code> プロパティが以下のことを定義します。</p> + +<ol> + <li>現在の<a href="/ja/docs/Web/Guide/CSS/Understanding_z_index/The_stacking_context">重ね合わせコンテキスト</a>におけるボックスの重ね合わせレベル</li> + <li>ボックスがローカルな重ね合わせコンテキストを作るかどうか</li> +</ol> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="brush:css no-line-numbers">/* キーワード値 */ +z-index: auto; + +/* <integer> 値 */ +z-index: 0; +z-index: 3; +z-index: 289; +z-index: -1; /* 負の数は優先度を下げる */ + +/* グローバル値 */ +z-index: inherit; +z-index: initial; +z-index: unset; +</pre> + +<p><code>z-index</code> プロパティは、キーワード <code><a href="#auto">auto</a></code> 又は <code><a href="#<integer>"><integer></a></code> のどちらかで指定します。</p> + +<h3 id="Values" name="Values">値</h3> + +<dl> + <dt><a id="auto" name="auto"><code>auto</code></a></dt> + <dd>ボックスはローカルな重ね合わせコンテキストを新たに作りません。現在の重ね合わせコンテキストで作られたボックスは、親ボックスと同じ重ね合わせレベルを持ちます。</dd> + <dt><a id="<integer>" name="<integer>"><code><integer></code></a></dt> + <dd>この整数値は、現在の重ね合わせコンテキストで作られたボックスの重ね合わせレベルです。ボックスは重ね合わせレベル <code>0</code> のローカルの重ね合わせコンテキストを作ります。これは、子孫要素の z-index は、この要素の外部にある要素の z-index とは比較されないということです。</dd> +</dl> + +<h3 id="Formal_syntax" name="Formal_syntax">形式文法</h3> + +<pre class="syntaxbox">{{csssyntax}}</pre> + +<h2 id="Examples" name="Examples">例</h2> + +<h3 id="HTML">HTML</h3> + +<pre class="brush: html"><div class="dashed-box">Dashed box + <span class="gold-box">Gold box</span> + <span class="green-box">Green box</span> +</div> +</pre> + +<h3 id="CSS">CSS</h3> + +<pre class="brush: css; highlight:[3,11,19]">.dashed-box { + position: relative; + z-index: 1; + border: dashed; + height: 8em; + margin-bottom: 1em; + margin-top: 2em; +} +.gold-box { + position: absolute; + z-index: 3; /* put .gold-box above .green-box and .dashed-box */ + background: gold; + width: 80%; + left: 60px; + top: 3em; +} +.green-box { + position: absolute; + z-index: 2; /* put .green-box above .dashed-box */ + background: lightgreen; + width: 20%; + left: 65%; + top: -25px; + height: 7em; + opacity: 0.9; +} +</pre> + +<h3 id="Result" name="Result">結果</h3> + +<p>{{ EmbedLiveSample('Examples', '550', '200', '') }}</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('CSS3 Transitions', '#animatable-css', 'animation behavior for z-index')}}</td> + <td>{{Spec2('CSS3 Transitions')}}</td> + <td><code>z-index</code> をアニメーション可能として定義</td> + </tr> + <tr> + <td>{{SpecName('CSS2.1', 'visuren.html#z-index', 'z-index')}}</td> + <td>{{Spec2('CSS2.1')}}</td> + <td>初回定義</td> + </tr> + </tbody> +</table> + +<p>{{cssinfo}}</p> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2> + +<div class="hidden">このページの互換性一覧表は構造化データから生成されています。データに協力していただけるのであれば、 <a class="external" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> をチェックアウトしてプルリクエストを送信してください。</div> + +<p>{{Compat("css.properties.z-index")}}</p> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li>CSS {{Cssxref("position")}} プロパティ</li> + <li><a href="/ja/docs/Web/CSS/Understanding_z-index">CSS の z-index の理解</a></li> +</ul> |