質問編集履歴

2

質問内容の整理、コードの変更

2019/08/23 09:01

投稿

yasu0716
yasu0716

スコア15

test CHANGED
File without changes
test CHANGED
@@ -2,27 +2,21 @@
2
2
 
3
3
 
4
4
 
5
- ヘッダー(width100%)、メニューバー(width100%)、コンテンツエリア(width80%)、
5
+ 全体の幅を960px、ヘッダー(width100%)、メニューバー(width100%)、コンテンツエリア(width80%)、
6
6
 
7
7
  サイドメニュー(width20%)、フッター(width100%)からなるレイアウトのwebページを作成したいです。
8
8
 
9
9
 
10
10
 
11
- メニューバーはsticky-topでスクロールしても画面上端に残るようにし、
11
+ メニューバースクロールしても画面上端に残るようにし、サイドメニューもそのすぐ下に固定したいです。
12
-
12
+
13
- サイドメニューもそのすぐ下に固定したいです。
13
+ サイドメニューをfixedで固定しましが、
14
-
15
- 全体をclass=wholeareaやarea(width100%)とし、サイドメニューを(width20%)としました。
14
+
16
-
17
- サイドメニューにfixed-topを入れるとメニューバーと被り、
18
-
19
- marginでスペ空けようとするとから変な位置に固定されてしまいます。
15
+ ヘッダ画像入れるとサイドメニューの期位置が下がるため、中途半端な位置に固定されてしまいます。
20
-
21
-
22
-
16
+
17
+
18
+
23
- 〇メニューバーとサイドバーを一緒に動かして画面上部に固定するにはどうしたらいいでしょうか。
19
+ サイドバーをメニューバーと一緒に動かしてメニューバー直下に固定するにはどうしたらいいでしょうか。相対位置を指定しての固定などできませんか・・・?
24
-
25
- 〇サイドメニューのheightをコンテンツエリアの高さと揃えるにはどうしたらいいでしょうか。
26
20
 
27
21
 
28
22
 

1

コードの変更、質問内容の整理

2019/08/23 09:01

投稿

yasu0716
yasu0716

スコア15

test CHANGED
File without changes
test CHANGED
@@ -1,3 +1,7 @@
1
+ 【整理しました】
2
+
3
+
4
+
1
5
  ヘッダー(width100%)、メニューバー(width100%)、コンテンツエリア(width80%)、
2
6
 
3
7
  サイドメニュー(width20%)、フッター(width100%)からなるレイアウトのwebページを作成したいです。
@@ -34,19 +38,47 @@
34
38
 
35
39
 
36
40
 
37
- ```ここに言語を入力
41
+ ```html
42
+
38
-
43
+ <!DOCTYPE html>
44
+
39
-
45
+ <html lang="ja">
46
+
47
+
48
+
49
+ <head>
50
+
51
+ <meta charset="utf-8">
52
+
53
+ <meta name="viewport" content="width=device-width">
54
+
55
+ <link rel="stylesheet" href="contact.css">
56
+
57
+ <!--CSS ライブラリ-->
58
+
59
+ <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
60
+
61
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/froala/design-blocks@master/dist/css/froala_blocks.min.css">
62
+
63
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,100i,300,300i,400,400i,500,500i,700,700i,900,900i">
64
+
65
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/froala-editor@2.9.1/css/froala_editor.pkgd.min.css">
66
+
67
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/froala-editor@2.9.1/css/froala_style.min.css">
68
+
69
+ </head>
40
70
 
41
71
  <body>
42
72
 
43
- <div class="wholearea">
73
+
44
-
74
+
45
- <header id="header">
75
+ <header id="header"><!--ヘッダー画像-->
76
+
77
+ <img src="" alt="Contact to us">
46
78
 
47
79
  </header>
48
80
 
49
- <nav class="navbar sticky-top navbar-light bg-white"><!--メニューバー-->
81
+ <nav class="navbar sticky-top navbar-light bg-white"><!--トップメニュー--><!--重要なリンクへ飛ばすnav-->
50
82
 
51
83
  <div class="dropdown">
52
84
 
@@ -54,29 +86,163 @@
54
86
 
55
87
  aria-expanded="false">
56
88
 
57
- Homeなど
89
+ Home
58
-
90
+
59
- </button>
91
+ </button>
92
+
60
-
93
+ <div class="dropdown-menu" aria-labelledby="dropdownMenu">
94
+
61
-
95
+ <li class="dropdown-item">
96
+
97
+ <a href="#">a</a>
98
+
99
+ </li>
100
+
101
+ <li class="dropdown-item">
102
+
103
+ <a href="#">b</a>
104
+
105
+ </li>
106
+
107
+ <li class="dropdown-item">
108
+
109
+ <a href="#">c</a>
110
+
111
+ </li>
112
+
113
+ <li class="dropdown-item">
114
+
115
+ <a href="#">d</a>
116
+
117
+ </li>
118
+
119
+ <li class="dropdown-item">
120
+
121
+ <a href="#">e</a>
122
+
123
+ </li>
124
+
125
+ <li class="dropdown-item">
126
+
127
+ <a href="#">f</a>
128
+
129
+ </li>
130
+
131
+ </div>
132
+
133
+ </div>
134
+
135
+ <div class="dropdown">
136
+
137
+ <button type="button" href="#" class="btn btn-info dropdown-toggle" id="dropdownMenu" data-toggle="dropdown" aria-haspopup="true"
138
+
139
+ aria-expanded="false">
140
+
141
+ A
142
+
143
+ </button>
144
+
145
+ <div class="dropdown-menu" aria-labelledby="dropdownMenu">
146
+
147
+ </div>
148
+
149
+ </div>
150
+
151
+ <div class="dropdown">
152
+
153
+ <button type="button" href="#" class="btn btn-info dropdown-toggle" id="dropdownMenu" data-toggle="dropdown" aria-haspopup="true"
154
+
155
+ aria-expanded="false">
156
+
157
+ B
158
+
159
+ </button>
160
+
161
+ <div class="dropdown-menu" aria-labelledby="dropdownMenu">
162
+
163
+ </div>
164
+
165
+ </div>
166
+
167
+ <div class="dropdown">
168
+
169
+ <button type="button" href="#" class="btn btn-info dropdown-toggle" id="dropdownMenu" data-toggle="dropdown" aria-haspopup="true"
170
+
171
+ aria-expanded="false">
172
+
173
+ C
174
+
175
+ </button>
176
+
177
+ <div class="dropdown-menu" aria-labelledby="dropdownMenu">
178
+
179
+ </div>
180
+
181
+ </div>
182
+
183
+ <div class="dropdown">
184
+
185
+ <button type="button" class="btn btn-info dropdown-toggle" id="dropdownMenu" data-toggle="dropdown" aria-haspopup="true"
186
+
187
+ aria-expanded="false">
188
+
189
+ D
190
+
191
+ </button>
192
+
193
+ <div class="dropdown-menu" aria-labelledby="dropdownMenu">
194
+
195
+ </div>
196
+
197
+ </div>
198
+
199
+ <div class="dropdown">
200
+
201
+ <button type="button" class="btn btn-info dropdown-toggle" id="dropdownMenu" data-toggle="dropdown" aria-haspopup="true"
202
+
203
+ aria-expanded="false">
204
+
205
+ E
206
+
207
+ </button>
208
+
209
+ <div class="dropdown-menu" aria-labelledby="dropdownMenu">
210
+
211
+ </div>
62
212
 
63
213
  </div>
64
214
 
65
215
  </nav>
66
216
 
67
- <div class="area">
217
+ <div class="wholearea">
218
+
219
+ <div class="area" ><!--コンテンツ-->
220
+
221
+ <div class="sidemenuboad">
68
222
 
69
223
  <div class="sidemenu"><!--サイドメニュー-->
70
224
 
71
225
  <div class="col-2">
72
226
 
73
- <section class="nav flex-column fixed-top nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
227
+ <section class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
74
228
 
75
229
  <table border="1" width="100%" table frame="void">
76
230
 
77
- <input class="button1" type="button" value="a">
231
+ <input class="button1" type="button" value="A">
78
-
232
+
79
- <input class="button1" type="button" value="b">
233
+ <input class="button1" type="button" value="B">
234
+
235
+ <input class="button1" type="button" value="C">
236
+
237
+ <input class="button1" type="button" value="D">
238
+
239
+ <input class="button1" type="button" value="E">
240
+
241
+ <input class="button1" type="button" value="F">
242
+
243
+ <input class="button1" type="button" value="G">
244
+
245
+ <input class="button1" type="button" value="H">
80
246
 
81
247
  </table>
82
248
 
@@ -84,9 +250,9 @@
84
250
 
85
251
  </div>
86
252
 
87
- </div>
253
+ </div></div>
88
-
254
+
89
- <div class="contents"><!--コンテンツエリア-->
255
+ <div class="contents"><!--メインコンテンツ-->
90
256
 
91
257
  <div class="col-10">
92
258
 
@@ -102,12 +268,20 @@
102
268
 
103
269
  </div>
104
270
 
271
+
272
+
273
+ </div>
274
+
105
- <footer class="footer"><!-- フッター -->
275
+ <footer class="footer"><!-- フッター -->
276
+
277
+ <div>
278
+
279
+ <p>aaaaaaaaaaaaa
280
+
281
+ </div>
106
282
 
107
283
  </footer>
108
284
 
109
- </div>
110
-
111
285
  </body>
112
286
 
113
287
 
@@ -118,10 +292,26 @@
118
292
 
119
293
  ```
120
294
 
121
- ```ここに言語を入力
295
+ ```CSS
122
296
 
123
297
  @charset "utf-8";
124
298
 
299
+
300
+
301
+ body {
302
+
303
+ width: 100%;
304
+
305
+ background-color:#FFF;
306
+
307
+ font-family: "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", "メイリオ", "Meiryo", "Osaka", "MS Pゴシック", "MS PGothic", sans-serif;
308
+
309
+ color:#000;
310
+
311
+ }
312
+
313
+
314
+
125
315
  header {
126
316
 
127
317
  position:relative;
@@ -130,99 +320,131 @@
130
320
 
131
321
  overflow:visible;
132
322
 
323
+ width:960px;
324
+
325
+ margin:0 auto;
326
+
133
- }
327
+ }
134
-
135
- /*-----コンテンツエリア全体-----*/
136
328
 
137
329
  .wholearea{
138
330
 
331
+ width:960px;
332
+
333
+ margin:0 auto;
334
+
335
+ overflow:hidden;
336
+
337
+ }
338
+
339
+ /*-----メニューバーの設定-----*/
340
+
341
+ nav:first-of-type {/*メニューバーら辺*/
342
+
343
+ text-align:center;
344
+
345
+ width:960px;
346
+
347
+ margin:0 auto;
348
+
349
+ border-bottom:3px double black;
350
+
351
+ margin:10px auto 15px auto;
352
+
353
+ }
354
+
355
+ .dropdown:hover > .dropdown-menu{
356
+
357
+ display:block;
358
+
359
+ }
360
+
361
+ /*-----サイドメニューエリアの設定-----*/
362
+
363
+ .sidemenuboad{
364
+
365
+ width:20%;
366
+
367
+ float:right;
368
+
369
+ background-color:rgb(181, 240, 240);
370
+
371
+ padding-bottom: 32767px;
372
+
373
+ margin-bottom: -32767px;
374
+
375
+ }
376
+
377
+ /*-----サイドメニューバーの設定-----*/
378
+
379
+ .sidemenu{
380
+
381
+ height:300px;
382
+
383
+ background-color:rgba(255, 255, 255,0);
384
+
385
+ position:fixed;
386
+
387
+ }
388
+
389
+ .sidemenu [type="button"]{
390
+
391
+ background-color:rgb(241, 197, 147);
392
+
393
+ margin:5px 5px 0 5px;
394
+
395
+ padding:2px 5px;
396
+
397
+ width:150px;
398
+
399
+ height:30px;
400
+
401
+ text-align:center;
402
+
403
+ display:inline-block;
404
+
405
+ color:rgb(0, 0, 0);
406
+
407
+ border-radius:5px;
408
+
409
+ }
410
+
411
+ .sidemenu [type="button"]:hover{
412
+
413
+ background-color:rgb(227, 230, 32);
414
+
415
+ }
416
+
417
+ /*-----メインエリアの設定-----*/
418
+
419
+ .contents{
420
+
421
+ width:80%;
422
+
423
+
424
+
425
+ float:left;
426
+
427
+ background-color:rgb(247, 236, 179);
428
+
429
+ overflow-wrap : break-word;
430
+
431
+ padding-bottom: 32767px;
432
+
433
+ margin-bottom: -32767px;
434
+
435
+ }
436
+
437
+ /*-----フッターの設定-----*/
438
+
439
+ .footer {
440
+
441
+ clear:both;/*回り込み解除*/
442
+
139
443
  width:100%;
140
444
 
141
- position:relative;
142
-
143
- }
144
-
145
- /*-----メニューバーの設定-----*/
146
-
147
- .dropdown:hover > .dropdown-menu{
148
-
149
- display:block;
150
-
151
- }
152
-
153
- /*-----コンテンツエリアの設定-----*/
154
-
155
- .area{
156
-
157
- width:100%;
158
-
159
- background-color: rgb(32, 167, 55);
160
-
161
- }
162
-
163
- /*-----サイドメニューエリアの設定-----*/
164
-
165
- .sidemenu{
166
-
167
- width:20%;
168
-
169
- float:right;
170
-
171
- background-color:rgb(181, 240, 240);
172
-
173
- }
174
-
175
- /*-----サイドメニューバーの設定-----*/
176
-
177
- .sidemenu [type="button"]{
178
-
179
- background-color:rgb(241, 197, 147);
180
-
181
- }
182
-
183
- .sidemenu [type="button"]:hover{
184
-
185
- background-color:rgb(227, 230, 32);
186
-
187
- }
188
-
189
- .button1{
190
-
191
- margin-top:5px;
192
-
193
- }
194
-
195
- /*-----メインエリアの設定-----*/
196
-
197
- .contents{
198
-
199
- width:80%;
200
-
201
- float:left;
202
-
203
- background-color:white;
204
-
205
- }
206
-
207
- .search [type="button"]:hover{
208
-
209
- background-color:rgb(199, 199, 199);
210
-
211
- }
212
-
213
- .footer {
214
-
215
- clear:both;/*回り込み解除*/
216
-
217
- width:100%;
218
-
219
445
  border-top:10px solid #000;
220
446
 
221
- }
222
-
223
- .footer div {
224
-
225
- margin:20px 0 0 20px;
447
+ text-align:center;
226
448
 
227
449
  }
228
450
 
@@ -234,12 +456,4 @@
234
456
 
235
457
  }
236
458
 
237
- .footer div small {
238
-
239
- font-size:0.6em;
240
-
241
- }
242
-
243
-
244
-
245
459
  ```