回答編集履歴

1

コメントを受けて追記

2020/08/26 03:41

投稿

Lhankor_Mhy
Lhankor_Mhy

スコア36106

test CHANGED
@@ -23,3 +23,253 @@
23
23
  }
24
24
 
25
25
  ```
26
+
27
+
28
+
29
+ # コメントを受けて追記
30
+
31
+
32
+
33
+ 以下のように変更してみてはいかがでしょうか。
34
+
35
+
36
+
37
+ [サンプル](https://jsfiddle.net/Lhankor_Mhy/an67y13e/)
38
+
39
+
40
+
41
+ ```scss
42
+
43
+
44
+
45
+ //ドロワーサイドメニュー
46
+
47
+ .side-menu {
48
+
49
+ position: fixed;
50
+
51
+ top: 0;
52
+
53
+ right: -300px;
54
+
55
+ width: 300px;
56
+
57
+ height: 100%;
58
+
59
+ padding-top: 150px;
60
+
61
+ text-align: left;
62
+
63
+ font-size: 13px;
64
+
65
+ background-color: rgba($font-color,0.95);
66
+
67
+ z-index: 2;
68
+
69
+ z-index: -1; // 追加
70
+
71
+
72
+
73
+ // ...
74
+
75
+
76
+
77
+ //ドロワー内コンテンツ
78
+
79
+ .wrapper {
80
+
81
+ position: relative;
82
+
83
+ width: 100%;
84
+
85
+ height: 100%;
86
+
87
+ -webkit-transition: all .5s ease;
88
+
89
+ transition: all .5s ease;
90
+
91
+ // z-index: 2; 削除
92
+
93
+ }
94
+
95
+
96
+
97
+ .contents {
98
+
99
+ width: 100%;
100
+
101
+ background: #fff;
102
+
103
+
104
+
105
+ }
106
+
107
+
108
+
109
+ // ...
110
+
111
+
112
+
113
+ // index.html トップページ
114
+
115
+ .top-wrapper {
116
+
117
+ background:linear-gradient(90deg,#fff 0%,#fff 24.5%,$bg-color 24.5%,$bg-color 100%);
118
+
119
+ color: #FFFFFF;
120
+
121
+ height: 668px;
122
+
123
+ position: relative;
124
+
125
+ // z-index: 0; 削除
126
+
127
+ margin-bottom: 78px;
128
+
129
+ @include mq('md') {
130
+
131
+ height: 1024px;
132
+
133
+ background:linear-gradient(90deg,#fff 0%,#fff 27%,$bg-color 27%,$bg-color 100%);
134
+
135
+ }
136
+
137
+ @include mq('lg') {
138
+
139
+ height: 740px;
140
+
141
+ background:linear-gradient(90deg,#fff 0%,#fff 46%,$bg-color 46%,$bg-color 100%);
142
+
143
+ }
144
+
145
+
146
+
147
+ // 追加
148
+
149
+ .top-text-logo,
150
+
151
+ .top-sub-head-top,
152
+
153
+ .top-sub-head-bottom
154
+
155
+ {
156
+
157
+ position: relative;
158
+
159
+ z-index: 1;
160
+
161
+ }
162
+
163
+ // 追加ここまで
164
+
165
+
166
+
167
+ &:before {
168
+
169
+ content: "";
170
+
171
+ position: absolute;
172
+
173
+ background-image: url(http://placehold.jp/24/cc9999/993333/150x100.png?text=the-honest-company-uM-WXMr-3@2x.png);
174
+
175
+ width: 76.5%;
176
+
177
+ height: 87%;
178
+
179
+ object-fit: cover;
180
+
181
+ background-position: 54.5% 0%;
182
+
183
+ background-size: 450%;
184
+
185
+ background-repeat: no-repeat;
186
+
187
+ // z-index: -2; 削除
188
+
189
+ @include mq('md') {
190
+
191
+ height: 87%;
192
+
193
+ width: 78%;
194
+
195
+ background-position: 55% 0;
196
+
197
+ background-size: 330%;
198
+
199
+ }
200
+
201
+ @include mq('lg') {
202
+
203
+ background-size: 123%;
204
+
205
+ background-position: 80% 5%;
206
+
207
+ width: 76.5%;
208
+
209
+ height: 86.5%;
210
+
211
+ }
212
+
213
+
214
+
215
+ }
216
+
217
+
218
+
219
+ &:after{
220
+
221
+ content: "";
222
+
223
+ position: absolute;
224
+
225
+ background-color: rgba($color: #000000, $alpha: 0.35);
226
+
227
+ width: 76.5%;
228
+
229
+ height: 87%;
230
+
231
+ background-position: 55% 0%;
232
+
233
+ top: 0;
234
+
235
+ // z-index: -2; 削除
236
+
237
+ @include mq('md') {
238
+
239
+ width: 78%;
240
+
241
+ height: 87%;
242
+
243
+ background-position: 45% 44%;
244
+
245
+
246
+
247
+ }
248
+
249
+ @include mq('lg') {
250
+
251
+ width: 76.5%;
252
+
253
+ height: 86.5%;
254
+
255
+ background-position: 30% 45%;
256
+
257
+ }
258
+
259
+ }
260
+
261
+ ```
262
+
263
+
264
+
265
+ ---
266
+
267
+
268
+
269
+ z-indexは意外とややこしい仕様なので、あまり多用すると自分の首を絞めかねないです。
270
+
271
+
272
+
273
+ 参考:
274
+
275
+ [君は真に理解しているか?z-indexとスタッキングコンテキストの関係 - ICS MEDIA](https://ics.media/entry/200609/)