回答編集履歴
1
説明追記
test
CHANGED
@@ -22,232 +22,30 @@
|
|
22
22
|
|
23
23
|
|
24
24
|
|
25
|
+
追記
|
26
|
+
|
27
|
+
---
|
28
|
+
|
29
|
+
サンプル作成している間に自己解決したのですね。
|
30
|
+
|
31
|
+
自己解決のコードをみてやっとやりたいことが理解できました。
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
複数の背景画像を固定したまま、スクロールで切り替えたいということですね。
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
質問のコードには背景画像が一つしかなかったので、そこまで推測できませんでした。
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
サンプルを書き直しました。ご参考になれば。
|
44
|
+
|
25
45
|
|
26
46
|
|
27
47
|
absoluteやfixedをやめて、gridレイアウトを活かしたコード例
|
28
48
|
|
29
49
|
|
30
50
|
|
31
|
-
|
32
|
-
|
33
|
-
```css
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
/* container
|
38
|
-
|
39
|
-
--------------------------------------------------------- */
|
40
|
-
|
41
|
-
.container {
|
42
|
-
|
43
|
-
display: grid;
|
44
|
-
|
45
|
-
grid-template-columns: 8fr 26fr;
|
46
|
-
|
47
|
-
animation: fadeIn 3s ease 0s 1 normal;
|
48
|
-
|
49
|
-
height: 100vh;
|
50
|
-
|
51
|
-
}
|
52
|
-
|
53
|
-
@keyframes fadeIn {
|
54
|
-
|
55
|
-
from {
|
56
|
-
|
57
|
-
opacity: 0;
|
58
|
-
|
59
|
-
}
|
60
|
-
|
61
|
-
to {
|
62
|
-
|
63
|
-
opacity: 1;
|
64
|
-
|
65
|
-
}
|
66
|
-
|
67
|
-
}
|
68
|
-
|
69
|
-
.container-right {
|
70
|
-
|
71
|
-
background-color: #f6f6f6;
|
72
|
-
|
73
|
-
color: #024058;
|
74
|
-
|
75
|
-
}
|
76
|
-
|
77
|
-
/* guide
|
78
|
-
|
79
|
-
--------------------------------------------------------- */
|
80
|
-
|
81
|
-
.guide {
|
82
|
-
|
83
|
-
display: grid;
|
84
|
-
|
85
|
-
grid-template-rows: 13fr 8fr;
|
86
|
-
|
87
|
-
place-items: center;
|
88
|
-
|
89
|
-
}
|
90
|
-
|
91
|
-
.face {
|
92
|
-
|
93
|
-
margin: 0 auto;
|
94
|
-
|
95
|
-
min-width: 100%;
|
96
|
-
|
97
|
-
max-width: 224px;
|
98
|
-
|
99
|
-
}
|
100
|
-
|
101
|
-
.face img {
|
102
|
-
|
103
|
-
border-radius: 50%;
|
104
|
-
|
105
|
-
}
|
106
|
-
|
107
|
-
.name {
|
108
|
-
|
109
|
-
font-family: serif;
|
110
|
-
|
111
|
-
letter-spacing: 0.1em;
|
112
|
-
|
113
|
-
text-align: center;
|
114
|
-
|
115
|
-
ruby-position: under;
|
116
|
-
|
117
|
-
}
|
118
|
-
|
119
|
-
.name rt {
|
120
|
-
|
121
|
-
font-size: 8px;
|
122
|
-
|
123
|
-
letter-spacing: 1em;
|
124
|
-
|
125
|
-
opacity: 0.5;
|
126
|
-
|
127
|
-
}
|
128
|
-
|
129
|
-
.global-nav {
|
130
|
-
|
131
|
-
align-self: start;
|
132
|
-
|
133
|
-
}
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
.nav-menu a {
|
138
|
-
|
139
|
-
font-family: serif;
|
140
|
-
|
141
|
-
font-size: 24px;
|
142
|
-
|
143
|
-
position: relative;
|
144
|
-
|
145
|
-
}
|
146
|
-
|
147
|
-
.nav-menu a:hover {
|
148
|
-
|
149
|
-
opacity: 1;
|
150
|
-
|
151
|
-
}
|
152
|
-
|
153
|
-
.nav-menu a::after {
|
154
|
-
|
155
|
-
content: "";
|
156
|
-
|
157
|
-
position: absolute;
|
158
|
-
|
159
|
-
bottom: -4px;
|
160
|
-
|
161
|
-
left: 0;
|
162
|
-
|
163
|
-
width: 100%;
|
164
|
-
|
165
|
-
height: 2px;
|
166
|
-
|
167
|
-
background-color: #fff;
|
168
|
-
|
169
|
-
transform: scale(0, 1);
|
170
|
-
|
171
|
-
transform-origin: center top;
|
172
|
-
|
173
|
-
transition: transform 250ms;
|
174
|
-
|
175
|
-
}
|
176
|
-
|
177
|
-
.nav-menu a:hover::after {
|
178
|
-
|
179
|
-
transform: scale(1, 1);
|
180
|
-
|
181
|
-
}
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
/* profile
|
186
|
-
|
187
|
-
--------------------------------------------------------- */
|
188
|
-
|
189
|
-
.profile {
|
190
|
-
|
191
|
-
height: 100%;
|
192
|
-
|
193
|
-
background-image: url(https://placehold.jp/2048x1364.png);
|
194
|
-
|
195
|
-
background-attachment: scroll;
|
196
|
-
|
197
|
-
background-position: center;
|
198
|
-
|
199
|
-
background-size: cover;
|
200
|
-
|
201
|
-
background-repeat: no-repeat;
|
202
|
-
|
203
|
-
overflow-y: scroll;
|
204
|
-
|
205
|
-
}
|
206
|
-
|
207
|
-
.parallax {
|
208
|
-
|
209
|
-
height: 100%;
|
210
|
-
|
211
|
-
}
|
212
|
-
|
213
|
-
.parallax h2 {
|
214
|
-
|
215
|
-
color:#fff;
|
216
|
-
|
217
|
-
font-family: Quicksand;
|
218
|
-
|
219
|
-
font-size: 80px;
|
220
|
-
|
221
|
-
text-shadow: 0px 0px 10px #c0c0c0;
|
222
|
-
|
223
|
-
text-align: center;
|
224
|
-
|
225
|
-
position: relative;
|
226
|
-
|
227
|
-
top: 20%;
|
228
|
-
|
229
|
-
}
|
230
|
-
|
231
|
-
.contents {
|
232
|
-
|
233
|
-
z-index: 1;
|
234
|
-
|
235
|
-
height:500px;
|
236
|
-
|
237
|
-
font-size:60px;
|
238
|
-
|
239
|
-
background: #f89174;
|
240
|
-
|
241
|
-
padding: 100px 20px;
|
242
|
-
|
243
|
-
text-align :center;
|
244
|
-
|
245
|
-
}
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
```
|
250
|
-
|
251
|
-
|
252
|
-
|
253
51
|
[CodePenサンプル](https://codepen.io/hatena19/pen/gOgdLxp?editors=0100)
|