回答編集履歴

5

説明の改善

2020/10/15 06:56

投稿

hatena19
hatena19

スコア33722

test CHANGED
@@ -13,10 +13,6 @@
13
13
 
14
14
 
15
15
  ---
16
-
17
- あっ、よく見たらBootStrap使ってますね。
18
-
19
- だとしたら、クラス名は .container-fluid ではなくて独自のクラス名を追加して設定する必要がありますね。
20
16
 
21
17
 
22
18
 

4

回答修正

2020/10/15 06:56

投稿

hatena19
hatena19

スコア33722

test CHANGED
@@ -20,7 +20,37 @@
20
20
 
21
21
 
22
22
 
23
+ ヘッダーブロック`nav.navvar`と次の背景画像のブロック`div.container-fluid`をdivで囲んで cover-img-wrapperクラスを設定して、
24
+
25
+ ```html
26
+
27
+ <div class="cover-img-wrapper">
28
+
23
- 親要素の `<div class="container-fluid">`を`<div class="container-fluid .cover-img-wrapper">` に変更して、CSSは下記で。
29
+ <nav class="navbar navbar-expand-lg navbar-light pt-4 pb-4">
30
+
31
+ <!-- 中略 -->
32
+
33
+ </nav>
34
+
35
+ <div class="container-fluid">
36
+
37
+ <!-- 中略 -->
38
+
39
+ </div>
40
+
41
+ </div>
42
+
43
+ <!-- Portfolioこちらを最後の</div>の後に入れる-->
44
+
45
+ <div id="portfolio">
46
+
47
+ <!-- 後略 -->
48
+
49
+ ```
50
+
51
+
52
+
53
+ CSSは下記で。
24
54
 
25
55
  ```css
26
56
 

3

コード追記

2020/10/15 06:19

投稿

hatena19
hatena19

スコア33722

test CHANGED
@@ -17,3 +17,85 @@
17
17
  あっ、よく見たらBootStrap使ってますね。
18
18
 
19
19
  だとしたら、クラス名は .container-fluid ではなくて独自のクラス名を追加して設定する必要がありますね。
20
+
21
+
22
+
23
+ 親要素の `<div class="container-fluid">`を`<div class="container-fluid .cover-img-wrapper">` に変更して、CSSは下記で。
24
+
25
+ ```css
26
+
27
+ .cover-img {
28
+
29
+ height: 100%;
30
+
31
+ display: table;
32
+
33
+ width: 100%;
34
+
35
+ background-size: cover;
36
+
37
+ position: absolute;
38
+
39
+ top: 0;
40
+
41
+ left: 0;
42
+
43
+ }
44
+
45
+ .cover-img-wrapper {
46
+
47
+ height: 600px;
48
+
49
+ position: relative;
50
+
51
+ }
52
+
53
+
54
+
55
+ /* ワイドスクリーン用のCSS */
56
+
57
+
58
+
59
+ @media only screen and (min-width: 1500px) {
60
+
61
+ .cover-img-wrapper { /* 修正 */
62
+
63
+ height: 1200px;
64
+
65
+ }
66
+
67
+ }
68
+
69
+
70
+
71
+ /* タブレット用のCSS */
72
+
73
+
74
+
75
+ @media only screen and (min-width: 768px) and (max-width: 1200px) {
76
+
77
+ .cover-img-wrapper { /* 修正 */
78
+
79
+ height: 500px;
80
+
81
+ }
82
+
83
+ }
84
+
85
+
86
+
87
+ /* スマホ用のCSS */
88
+
89
+
90
+
91
+ @media only screen and (max-width: 479px) {
92
+
93
+ .cover-img-wrapper {
94
+
95
+ height: 300px;
96
+
97
+ }
98
+
99
+ }
100
+
101
+ ```

2

修正

2020/10/15 04:24

投稿

hatena19
hatena19

スコア33722

test CHANGED
@@ -17,15 +17,3 @@
17
17
  あっ、よく見たらBootStrap使ってますね。
18
18
 
19
19
  だとしたら、クラス名は .container-fluid ではなくて独自のクラス名を追加して設定する必要がありますね。
20
-
21
- あと、
22
-
23
- width: 100%;
24
-
25
- position: absolute;
26
-
27
- top: 0;
28
-
29
- left: 0;
30
-
31
- も親要素に移動させる必要があります。

1

コード追記

2020/10/15 04:01

投稿

hatena19
hatena19

スコア33722

test CHANGED
@@ -9,3 +9,23 @@
9
9
 
10
10
 
11
11
  現状は`.cover-img`の高さをメディアクエリで段階的に変化させてますので、それを親要素の`.container-fluid`に変更すればいいでしょう。
12
+
13
+
14
+
15
+ ---
16
+
17
+ あっ、よく見たらBootStrap使ってますね。
18
+
19
+ だとしたら、クラス名は .container-fluid ではなくて独自のクラス名を追加して設定する必要がありますね。
20
+
21
+ あと、
22
+
23
+ width: 100%;
24
+
25
+ position: absolute;
26
+
27
+ top: 0;
28
+
29
+ left: 0;
30
+
31
+ も親要素に移動させる必要があります。