teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

一応強調しておきます。

2021/06/01 05:44

投稿

Lhankor_Mhy
Lhankor_Mhy

スコア37481

answer CHANGED
@@ -36,7 +36,7 @@
36
36
  1. the in-flow, non-inline-level, non-positioned descendants.
37
37
  1. the non-positioned floats.
38
38
  1. the in-flow, inline-level, non-positioned descendants, including inline tables and inline blocks.
39
- 1. the child stacking contexts with stack level 0 and the positioned descendants with stack level 0.
39
+ 1. the child stacking contexts with stack level 0 and **the positioned descendants with stack level 0**.
40
40
  1. the child stacking contexts with positive stack levels (least positive first).
41
41
  >
42
42
  [Visual formatting model](https://www.w3.org/TR/CSS2/visuren.html#z-index)

1

補足欄を読んで追記

2021/06/01 05:43

投稿

Lhankor_Mhy
Lhankor_Mhy

スコア37481

answer CHANGED
@@ -8,4 +8,35 @@
8
8
  }
9
9
  ```
10
10
 
11
- 絶対配置をした要素は通常のフローから外れるため、後続の要素は絶対配置した要素がないものとして上に詰められます。
11
+ 絶対配置をした要素は通常のフローから外れるため、後続の要素は絶対配置した要素がないものとして上に詰められます。
12
+
13
+ ---
14
+
15
+ # 補足欄を読んで追記
16
+
17
+ >__画像の下に来ることを想定しています。__
18
+
19
+ なるほど、問題を理解しました。
20
+
21
+ それは以下で、相対配置をしていることが原因です。
22
+
23
+ ```css
24
+ .article {
25
+ position: relative;
26
+ }
27
+ ```
28
+
29
+ > つまり、position: absolute (relative)を指定した時点で通常の要素より上にきて、z-index: autoの振る舞いをします。そのため、transformなどのスタッキングコンテキストの後にposition要素を配置した場合、スタッキングコンテキストでもないのにも関わらず、スタッキングコンテキストより上になります。
30
+ [君は真に理解しているか?z-indexとスタッキングコンテキストの関係 - ICS MEDIA](https://ics.media/entry/200609/)
31
+
32
+  
33
+ > Within each stacking context, the following layers are painted in back-to-front order:
34
+ 1. the background and borders of the element forming the stacking context.
35
+ 1. the child stacking contexts with negative stack levels (most negative first).
36
+ 1. the in-flow, non-inline-level, non-positioned descendants.
37
+ 1. the non-positioned floats.
38
+ 1. the in-flow, inline-level, non-positioned descendants, including inline tables and inline blocks.
39
+ 1. the child stacking contexts with stack level 0 and the positioned descendants with stack level 0.
40
+ 1. the child stacking contexts with positive stack levels (least positive first).
41
+ >
42
+ [Visual formatting model](https://www.w3.org/TR/CSS2/visuren.html#z-index)