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

質問編集履歴

2

コードの掲載

2019/09/13 13:16

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -7,4 +7,242 @@
7
7
  .red{
8
8
  position: absolute
9
9
  }
10
+ ```
11
+ ### 現段階の表示結果
12
+ 現在、アイコンをタップするとハンバーガーメニューができる様にしているのですが、スクロールすると表示が切り替わる背景画像が、一番上に表示されている為、ハンバーガーメニューが表示されません。
13
+
14
+ ### ハンバーガーメニューのコード
15
+ ```html
16
+ header><link rel="stylesheet" type="text/css" href="ham-01.css">
17
+ <div id="nav-drawer">
18
+ <input id="nav-input" type="checkbox" class="nav-unshown">
19
+ <label id="nav-open" for="nav-input"><span></span></label>
20
+ <label class="nav-unshown" id="nav-close" for="nav-input"></label>
21
+ <div id="nav-content">
22
+ <a href="ev_index.html">HOME</a>
23
+ <a href="ev_exp.html">EVENT</a>
24
+ <a href="">POSTER</a>
25
+ <a href="ev_school.html">SCHOOL</a>
26
+ <a href="ev_access.html">ACCESS</a>
27
+ <a href="#">ABOUT THIS SITE</a>
28
+ </div>
29
+ </header>
30
+ ```
31
+ ```css
32
+ header {
33
+ padding:10px;
34
+ }
35
+ #nav-content a {
36
+ z-index: 30;
37
+ display: block;
38
+ text-align: center;
39
+ width: 80%;
40
+ max-width: 300px;
41
+ margin: 1rem auto;
42
+ padding: 0.5rem 0;
43
+ background: #777;
44
+ color: #fff;
45
+ font-famile: sans-serif;
46
+ text-decoration: none
47
+ }
48
+ #nav-drawer {
49
+ position: fixed;top: 0:left:0;
50
+ }
51
+
52
+ /*チェックボックス等は非表示に*/
53
+ .nav-unshown {
54
+ display:none;
55
+ }
56
+
57
+ /*アイコンのスペース*/
58
+ #nav-open {
59
+ display: inline-block;
60
+ width: 30px;
61
+ height: 22px;
62
+ vertical-align: middle;
63
+ }
64
+
65
+ /*ハンバーガーアイコンをCSSだけで表現*/
66
+ #nav-open span, #nav-open span:before, #nav-open span:after {
67
+ position: absolute;
68
+ height: 3px;/*線の太さ*/
69
+ width: 25px;/*長さ*/
70
+ border-radius: 3px;
71
+ background: #555;
72
+ display: block;
73
+ content: '';
74
+ cursor: pointer;
75
+ }
76
+ #nav-open span:before {
77
+ bottom: -8px;
78
+ }
79
+ #nav-open span:after {
80
+ bottom: -16px;
81
+ }
82
+
83
+ /*閉じる用の薄黒カバー*/
84
+ #nav-close {
85
+ display: none;/*はじめは隠しておく*/
86
+ position: fixed;
87
+ z-index: 99;
88
+ top: 0;/*全体に広がるように*/
89
+ left: 0;
90
+ width: 100%;
91
+ height: 100%;
92
+ background: black;
93
+ opacity: 0;
94
+ transition: .3s ease-in-out;
95
+ }
96
+
97
+ /*中身*/
98
+ #nav-content {
99
+ overflow: auto;
100
+ position: fixed;
101
+ top: 0;
102
+ left: 0;
103
+ z-index: 9999;/*最前面に*/
104
+ width: 90%;/*右側に隙間を作る(閉じるカバーを表示)*/
105
+ max-width: 330px;/*最大幅(調整してください)*/
106
+ height: 100%;
107
+ background: #333;/*背景色*/
108
+ transition: .3s ease-in-out;/*滑らかに表示*/
109
+ -webkit-transform: translateX(-105%);
110
+ transform: translateX(-105%);/*左に隠しておく*/
111
+ }
112
+
113
+ /*チェックが入ったらもろもろ表示*/
114
+ #nav-input:checked ~ #nav-close {
115
+ display: block;/*カバーを表示*/
116
+ opacity: .5;
117
+ }
118
+
119
+ #nav-input:checked ~ #nav-content {
120
+ -webkit-transform: translateX(0%);
121
+ transform: translateX(0%);/*中身を表示(右へスライド)*/
122
+ box-shadow: 6px 0 25px rgba(0,0,0,.15);
123
+ }
124
+
125
+
126
+ }
127
+ .site-header{
128
+ background: #fff;
129
+ display: flex;
130
+ padding: 60px 20px;
131
+ position: fixed;
132
+ justify-content: space-between;
133
+ width: 100%;
134
+ }
135
+ .site-logo img{
136
+ height: 20px;
137
+ width: auto;
138
+ }
139
+ .gnav__menu{
140
+ display: flex;
141
+ }
142
+ .gnav__menu__item{
143
+ margin-left: 20px;
144
+ }
145
+ .gnav__menu__item a{
146
+ color: #333;
147
+ text-decoration: none;
148
+ }
149
+ .hero{
150
+ max-height: 500px;
151
+ overflow: hidden;
152
+ }
153
+ .hero img{
154
+ height: auto;
155
+ width: 100%;
156
+ }
157
+ .content{
158
+ line-height: 1.6;
159
+ margin: 0 auto;
160
+ padding-top: 100px;
161
+ width: 800px;
162
+ }
163
+ .content p{
164
+ margin-bottom: 40px;
165
+ }
166
+ .site-footer{
167
+ background: #333;
168
+ padding: 80px 0;
169
+ }
170
+ .copyright{
171
+ color: #fff;
172
+ font-size: 12px;
173
+ text-align: center;
174
+ }
175
+ ```
176
+
177
+ ### 背景画像
178
+
179
+ ```html
180
+ <div class="scroll-bg bg-color01" class="start">
181
+ <p style="background-color:#ffcc99;">説明文が入る</p>
182
+ </div>
183
+ <div class="fixed-bg bg01 sentence">
184
+ <p>タイトル</p>
185
+ </div>
186
+
187
+ <div class="scroll-bg bg-color01" class="start">
188
+ <p style="background-color:#ffcc99;">説明文が入る。</p>
189
+ </div>
190
+
191
+ <div class="fixed-bg bg02 sentence">
192
+ <p>タイトル</p>
193
+ </div>
194
+
195
+ <div class="scroll-bg bg-color02">
196
+ <p style="background-color:#ffcc99;">説明文が入る</p>
197
+ </div>
198
+ ```
199
+ ```css
200
+ .fixed-bg {
201
+ min-height: 100vh;
202
+ background-attachment: fixed;
203
+ background-size: cover;
204
+ background-position: center;
205
+ }
206
+
207
+ .bg01 {
208
+ background-image: url(170923.png);
209
+ /*background-size: contain; */
210
+ background-repeat: no-repeat;
211
+ background-size: cover;
212
+ }
213
+
214
+ .bg02 {
215
+ background-image: url(7211.png);
216
+ background-repeat: no-repeat;
217
+ background-size: cover;
218
+ }
219
+
220
+ .bg03 {
221
+ background-image: url(2377.png);
222
+ background-repeat: no-repeat;
223
+ background-size: cover;
224
+ }
225
+
226
+ .sentence{
227
+ position: relative;
228
+ }
229
+
230
+ .sentence p{
231
+ position: absolute;
232
+ top: 50%;
233
+ left: 50%;
234
+ -ms-transform: translate(-50%,-50%);
235
+ -webkit-transform: translate(-50%,-50%);
236
+ transform: translate(-50%,-50%);
237
+ margin:0;
238
+ padding:0;
239
+ color: white;/*文字は白に*/
240
+ font-weight: bold; /*太字に*/
241
+ font-size: 2em;/*サイズ2倍*/
242
+ font-family :Quicksand, sans-serif;/*Google Font*/
243
+ }
244
+
245
+ .sentence img{
246
+ width: 100%;
247
+ }
10
248
  ```

1

問題の具体的化

2019/09/13 13:16

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -1,4 +1,5 @@
1
- [参考にしたサイト](https://saruwakakun.com/html-css/basic/z-index)では、classを使って、重なり位置を指定しているのですが、一つのclassを設定し一番表に表示することは可能すか?
1
+ [参考にしたサイト](https://saruwakakun.com/html-css/basic/z-index)では、classを使って、z-index数字によって、大きい順に表示する様に設定しているのですが、classが多くべてにz-indexをつけはなく、
2
+ 一番上に表示されるのは、このclassという事は出来ないのでしょうか? 
2
3
 
3
4
  例) class名: ("red black white")
4
5
  一番表に表示指定class名: red