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

回答編集履歴

1

追記

2019/05/20 03:36

投稿

s8_chu
s8_chu

スコア14731

answer CHANGED
@@ -176,4 +176,228 @@
176
176
  border-right: 1px solid #ccc;
177
177
  }
178
178
  }
179
+ ```
180
+
181
+ ---
182
+
183
+ **追記**
184
+ 以下のようにすることで、質問者さんの実現したいことが行なえると思います([動作確認用リンク](https://codepen.io/anon/pen/byrKRW))。
185
+ ```CSS
186
+ * {
187
+ margin: 0;
188
+ padding: 0;
189
+ list-style: none;
190
+ box-sizing: border-box;
191
+ color: #333;
192
+ }
193
+
194
+ a {
195
+ text-decoration: none;
196
+ }
197
+
198
+ html,
199
+ body,
200
+ .wrapper {
201
+ height: 100%;
202
+ }
203
+
204
+ .header-wrapper {
205
+ top: 0px;
206
+ z-index: 3;
207
+ }
208
+
209
+ .topbar {
210
+ float: left;
211
+ }
212
+
213
+ .site-branding {
214
+ display: inline-block;
215
+ }
216
+
217
+ .site-message {
218
+ display: inline-block;
219
+ }
220
+
221
+ .global-nav {
222
+ width: 100%;
223
+ }
224
+
225
+ .nav-category {
226
+ width: 100%;
227
+ position: relative; /* 追加 */
228
+ }
229
+
230
+ .nav-category > a {
231
+ display: block;
232
+ width: 100%;
233
+ padding: 10px 0;
234
+ border-bottom: 1px solid #ccc;
235
+ background-color: #fff;
236
+ color: #000;
237
+ text-align: center;
238
+ }
239
+
240
+ .nav-category:first-child > a {
241
+ border-top: 1px solid #ccc;
242
+ }
243
+
244
+ .nav-container {
245
+ display: none;
246
+ position: absolute; /* 変更 */
247
+ width: 100%; /* 追加 */
248
+ z-index:1 !important;
249
+ }
250
+
251
+ .nav-contant {
252
+ position: relative;
253
+ z-index: 99;
254
+ }
255
+
256
+ .nav-contant > a{
257
+ z-index: 99;
258
+ position: relative;
259
+ display: block;
260
+ width: 100%;
261
+ padding: 10px 5%;
262
+ border-bottom: 1px solid #ccc;
263
+ background-color: #111;
264
+ color: #fff;
265
+ }
266
+
267
+ .nav-category > a:hover,
268
+ .nav-contant > a:hover {
269
+ background-color: #aaa;
270
+ }
271
+
272
+ .menu-hb {
273
+ height:100%;
274
+ text-align: right;
275
+ padding-right: 20px;
276
+ }
277
+
278
+ .menu-trigger,
279
+ .menu-trigger span {
280
+ display: inline-block;
281
+ transition: all .4s;
282
+ box-sizing: border-box;
283
+ }
284
+
285
+ .menu-trigger {
286
+ position: relative;
287
+ top:10px;
288
+ width: 40px;
289
+ height: 30px;
290
+ padding-right: 5px;
291
+ cursor: pointer;
292
+ }
293
+
294
+ .menu-trigger span {
295
+ position: absolute;
296
+ left: 0;
297
+ width: 100%;
298
+ height: 4px;
299
+ background-color: #000;
300
+ border-radius: 4px;
301
+ }
302
+
303
+ .menu-trigger span:nth-of-type(1) {
304
+ top: 0;
305
+ }
306
+
307
+ .menu-trigger span:nth-of-type(2) {
308
+ top: 13px;
309
+ }
310
+
311
+ .menu-trigger span:nth-of-type(3) {
312
+ bottom: 0;
313
+ }
314
+
315
+ #menu01:not(.active):hover span:nth-of-type(1) {
316
+ top: 2px;
317
+ }
318
+
319
+ #menu01:not(.active):hover span:nth-of-type(3) {
320
+ bottom: 2px;
321
+ }
322
+
323
+ #menu01.active span:nth-of-type(1) {
324
+ -webkit-transform: translateY(13.5px) rotate(-315deg) scale(.8);
325
+ transform: translateY(13.5px) rotate(-315deg) scale(.8);
326
+ }
327
+
328
+ #menu01.active span:nth-of-type(2) {
329
+ top: 50%;
330
+ left: 50%;
331
+ width: 40px;
332
+ height: 40px;
333
+ background-color: transparent;
334
+ border: 3px solid #000;
335
+ border-radius: 50%;
336
+ -webkit-transform: translate3d(-50%, -50%, 0);
337
+ transform: translate3d(-50%, -50%, 0);
338
+ }
339
+
340
+ #menu01.active span:nth-of-type(3) {
341
+ -webkit-transform: translateY(-13.5px) rotate(315deg) scale(.8);
342
+ transform: translateY(-13.5px) rotate(315deg) scale(.8);
343
+ }
344
+
345
+ .main-img {
346
+ width: 100%;
347
+ height: 500px;
348
+ background: red;
349
+ position: relative;
350
+ z-index: 0 !important;
351
+ }
352
+
353
+ .navbar { /* 追加 */
354
+ position: relative;
355
+ }
356
+
357
+ .navbar-innner{ /* 追加 */
358
+ position: absolute;
359
+ width: 100%;
360
+ z-index: 1;
361
+ }
362
+
363
+ @media screen and (min-width: 700px) {
364
+ .header-wrapper {
365
+ margin: 0 10%;
366
+ }
367
+
368
+ .topbar {
369
+ width: 300px;
370
+ }
371
+
372
+ .global-nav {
373
+ width: 960px;
374
+ margin-left: auto;
375
+ font-size: 0;
376
+ }
377
+
378
+ .nav-category {
379
+ display: inline-block;
380
+ width: calc(100% / 5);
381
+ font-size: 1rem;
382
+ vertical-align: top;
383
+ }
384
+
385
+ .nav-category > a {
386
+ border: none;
387
+ border-left: 1px solid #ccc;
388
+ }
389
+
390
+ .nav-category:first-child > a {
391
+ border-top: none;
392
+ }
393
+
394
+ .nav-category:last-child > a {
395
+ border-top: none;
396
+ border-right: 1px solid #ccc;
397
+ }
398
+
399
+ .navbar-innner{ /* 追加 */
400
+ position :static;
401
+ }
402
+ }
179
403
  ```