回答編集履歴

1

回答追記

2022/10/03 07:20

投稿

hatena19
hatena19

スコア33775

test CHANGED
@@ -18,3 +18,57 @@
18
18
  ---
19
19
  以上の点を考慮して、設定を見直してみてください。
20
20
 
21
+ ---
22
+ レイアウト画像が提示されましたので、それに合わせてアドバイスするなら、下記になります。
23
+
24
+ 背景画像はCSSのbackground-imagedで設定した方が楽でしょう。
25
+ 画面幅で画像サイズを変更したいならメディアクエリを使えば可能です。
26
+ 中央に配置したい要素(画像)は FlexBoxレイアウトで縦横中央に配置すればいいでしょう。
27
+
28
+ 上記をもとに一つのサンプルを作成してみました。
29
+
30
+ ```html
31
+ <div class="header">
32
+ <div class="fade header_yama">
33
+ </div>
34
+ <div class="header-image">
35
+ <h1 class="logo_box">
36
+ <img src="https://placehold.jp/1061x240.png" alt="" class="fade begi_logo">
37
+ </h1>
38
+ </div>
39
+ ```
40
+
41
+ ```css
42
+ body {
43
+ margin: 0;
44
+ }
45
+ .header {
46
+ width: 100%;
47
+ height: 100vh;
48
+ }
49
+ .header-image {
50
+ width: 100%;
51
+ height: 80vh;
52
+ background: center / cover no-repeat url(https://picsum.photos/1920/1080);
53
+ display: flex;
54
+ justify-content: center;
55
+ align-items: center;
56
+ }
57
+ .header_yama {
58
+ width: 100%;
59
+ height: 20vh;
60
+ background: center / cover no-repeat url(https://picsum.photos/1500/500);
61
+ }
62
+ h2 {
63
+ color: #6d5c51;
64
+ }
65
+ .logo_box {
66
+ width: 80vw;
67
+ }
68
+ .logo_box > img {
69
+ width: 100%;
70
+ }
71
+ ```
72
+
73
+ [CodePenサンプル](https://codepen.io/hatena19/pen/YzLLbPd)
74
+