Home » ★スタイルシートリファレンス

★スタイルシートリファレンス

z-index …… 重なりの順序を指定する
Internet Explorer4Internet Explorer5Internet Explorer5-macInternet Explorer5.5Internet Explorer6Internet Explorer7Internet Explorer8Internet Explorer9
Netscape4Netscape6Netscape7Netscape8
Opera6Opera7Opera8Opera9Opera10
Firefox1Firefox2Firefox3Firefox4
Google Chrome1Google Chrome2Google Chrome3Google Chrome4Google Chrome5Google Chrome6
広告



z-indexプロパティは、ボックスの重なりの順序を指定する際に使用します。
z-indexプロパティは、positionプロパティでstatic以外の値が指定されている要素に適用されます。

■値

整数値で指定
重なりの順序を整数で指定します。0を基準として、値が大きいものほど上になります。
auto
親要素と同じ階層になります。これが初期値です。

■使用例

スタイルシート部分は外部ファイル(sample.css)に記述。

p.sample {
color: #000000; background-color: #99cc00;
position: relative; top: 50px; z-index: 2;
}
img.sample {
position: relative; top: -50px; z-index: 1;
}

HTMLソース

<html>
<head>
<link rel=”stylesheet” href=”sample.css”
type=”text/css”>
</head>
<body>
<p class=”sample”>上に重なります。</p>
<img src=”https://htmqcom1.wpengine.com/wp-content/uploads/2024/07/img001.gif”
alt=”サンプル画像” class=”sample”>
</body>
</html>

↓↓↓

ブラウザ上の表示

上に重なります。

サンプル画像

■関連項目

overflow …… はみ出た内容の表示方法を指定する
overflow-x …… はみ出た内容の表示方法を指定する(IE独自の仕様)
overflow-y …… はみ出た内容の表示方法を指定する(IE独自の仕様)
position …… ボックスの配置方法(基準位置)を指定する
top …… 上からの配置位置(距離)を指定する
bottom …… 下からの配置位置(距離)を指定する
left …… 左からの配置位置(距離)を指定する
right …… 右からの配置位置(距離)を指定する
display …… 要素の表示形式(ブロック・インライン・フレックス等)を指定する
float …… 左または右に寄せて配置する
clear …… 回り込みを解除する
z-index …… 重なりの順序を指定する
visibility …… ボックスの表示・非表示を指定する
clip …… ボックスを切り抜き表示(クリッピング)する
direction …… 文字表記の方向(左右)を指定する
unicode-bidi …… Unicodeの文字表記の方向を上書きする
writing-mode …… 文字表記の方向(縦横)を指定する(IE独自の仕様)
広告



Lorem Ipsum is simply dummy text

    By signing up, you agree to our Terms and Privacy Policy. Unsubscribe anytime.