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

質問編集履歴

1

scssのheader内全文を追記致しました。

2021/03/06 13:16

投稿

duu
duu

スコア1

title CHANGED
File without changes
body CHANGED
@@ -47,48 +47,328 @@
47
47
 
48
48
  ```
49
49
 
50
- コンパイル後➤
51
50
 
51
+ ![イメージ説明](43f3d70a7979e968b5bbe4577143483f.png)
52
+
53
+
52
- ```CSS
54
+ ```scss
53
- #header .header__title {
55
+ @charset "UTF-8";
56
+
57
+ /* 関数 */
54
- color: #ffffff;
58
+ $white:#ffffff;
59
+ $black:#222;
60
+ $gray:#525252;
61
+ $back:#F2F2F2;
62
+ $fontM: 'Montserrat', sans-serif;
63
+ $fontS: 'Noto Sans JP', sans-serif;
64
+ $fontY:"游ゴシック体", YuGothic, "游ゴシック Medium", "Yu Gothic Medium", "游ゴシック", "Yu Gothic", sans-serif;
65
+ $textMargin:30px 0;
66
+
67
+ @mixin padding($padding){
68
+ padding-left: $padding;
69
+ padding-right: $padding;
70
+ }
71
+
72
+ @mixin header-image($width,$height){
73
+ width: $width;
74
+ height: $height;
75
+ margin:0 calc(50% - 50vw);
76
+ position: absolute;
77
+ top: 0;
78
+ z-index: -2;
79
+ }
80
+ @mixin header-black($width,$height){
81
+ background:$black;
82
+ width: $width;
83
+ height: $height;
84
+ position: absolute;
85
+ right: 0;
86
+ top: 0;
87
+ z-index: -3;
88
+ }
89
+
90
+ @mixin header-title($width){
91
+ color: $white;
55
- height: 100vh;
92
+ height: $width;
56
- display: -webkit-box;
57
- display: -ms-flexbox;
58
93
  display: flex;
59
- -webkit-box-orient: vertical;
60
- -webkit-box-direction: normal;
61
- -ms-flex-direction: column;
62
- flex-direction: column;
94
+ flex-direction: column;
63
- -webkit-box-align: end;
64
- -ms-flex-align: end;
65
- align-items: flex-end;
95
+ align-items: flex-end;
66
- -webkit-box-pack: center;
67
- -ms-flex-pack: center;
68
- justify-content: center;
96
+ justify-content: center;
69
97
  }
70
98
 
99
+
71
- #header .header__title-about {
100
+ @mixin description($weight){
101
+ font-family: $fontY;
102
+ font-weight: $weight;
103
+ font-size: 1.6rem;
104
+ padding-top: 17px;
105
+ padding-bottom: 18px;
106
+
107
+ }
108
+ /* 共通 */
109
+ html{
110
+ font-size: 62.5%;
111
+ scroll-behavior: smooth;
112
+ }
113
+
114
+ body *{
115
+ box-sizing: border-box;
116
+
117
+ }
118
+ body{
119
+ &::after{
120
+ content: '';
72
- color: #ffffff;
121
+ position: fixed;
122
+ top: 0;
123
+ left: 0;
124
+ width: 100%;
73
- height: 63vh;
125
+ height: 100%;
126
+ background-color:#fff; /* 背景カラー */
127
+ z-index: 9999; /* 一番手前に */
128
+ pointer-events: none; /* 他の要素にアクセス可能にするためにポインターイベントは無効に */
129
+ opacity: 0; /* 初期値 : 透過状態 */
130
+ -webkit-transition: opacity .4s linear; /* アニメーション時間は 0.8秒 */
131
+ transition: opacity .4s linear;
132
+ }
133
+ &.fadeout::after{
134
+ opacity:1;
135
+ -webkit-transition: opacity .4s linear; /* アニメーション時間は 0.8秒 */
136
+ transition: opacity .4s linear;
137
+ }
138
+ }
139
+ section{
74
- display: -webkit-box;
140
+ @include padding(170px);
75
- display: -ms-flexbox;
141
+ font-family: $fontM;
142
+ font-family: $fontS;
143
+ font-family: $fontY;
144
+ }
145
+
146
+ .read_more{
147
+ width: 160px;
148
+ height: 36px;
149
+ background-color: $black;
76
150
  display: flex;
77
- -webkit-box-orient: vertical;
78
- -webkit-box-direction: normal;
79
- -ms-flex-direction: column;
80
- flex-direction: column;
81
- -webkit-box-align: end;
82
- -ms-flex-align: end;
83
- align-items: flex-end;
84
- -webkit-box-pack: center;
85
- -ms-flex-pack: center;
86
- justify-content: center;
151
+ justify-content: center;
152
+ align-items: center;
153
+ text-align: center;
154
+ a{
155
+ border: none;
156
+ display: block;
157
+ width: 100%;
158
+ color: $white;
159
+ background-color: $black;
160
+ text-decoration: none;
161
+ font-style: $fontM;
162
+ font-weight: bold;
163
+ }
164
+
87
165
  }
88
- ```
89
166
 
167
+ h2{
168
+ font-family: $fontM;
169
+ font-weight: bold;
170
+ font-size: 3.2rem;
90
- ![イメージ説明](43f3d70a7979e968b5bbe4577143483f.png)
171
+ line-height: (94 / 32);
172
+ }
91
173
 
174
+ h3{
175
+ font-size: 2.4rem;
176
+ font-weight: bold;
177
+ font-family: $fontY;
178
+ }
179
+ p{
180
+ font-size: 1.6rem;
181
+ }
182
+
183
+ li{
184
+ list-style: none;
185
+ }
186
+
187
+ //HEADER
188
+ #header{
189
+ margin: 0 calc(50% - 50vw);
190
+ // height: 100vh;
191
+ position: relative;
192
+ .header__background{
193
+ background:url(../images/kv-img2x.png)no-repeat center/cover;
194
+ @include header-image(76vw,86vh );
195
+
196
+ &-about{
197
+ background: url(../images/heading-img@2x.png)no-repeat center/cover;
198
+ @include header-image(76vw,52vh );
199
+ }
200
+
201
+ }
202
+ .header__background--black{
203
+ @include header-black(50%,100vh );
204
+ &-about{
205
+ @include header-black(50%,63vh );
206
+ }
207
+ }
208
+ .header__background--gray{
209
+ width: 100vw;
210
+ height: 100vh;
211
+ background-color: rgba($color: $black, $alpha: 0.6);
212
+ display: none;
213
+ position: absolute;
214
+ z-index: -1;
215
+
216
+ }
217
+ .header__title{
218
+
219
+ @include header-title(100vh);
220
+ &-about{
221
+ @include header-title(63vh);
222
+ }
223
+
224
+ &--subtitle{
225
+ font-family: $fontY;
226
+ font-family: $fontM;
227
+ font-size: 2rem;
228
+ line-height: 1;
229
+ font-weight: bold;
230
+ }
231
+ &--maintitle{
232
+ font-family: $fontM;
233
+ font-size: 7.2rem;
234
+ line-height: (86 / 72);
235
+ font-weight: bold;
236
+
237
+ }
238
+ }
239
+ .header__nav{
240
+ display: flex;
241
+ width: 100vw;
242
+ justify-content: space-between;
243
+ align-items: center;
244
+ padding: 30px 58px 30px;
245
+ position: fixed;
246
+ z-index: 1;
247
+
248
+ &.withColor{
249
+ transition: all 0.3s ease;
250
+ background-color:rgba($color: $black, $alpha: 0.9)
251
+ }
252
+
253
+ &--logo.gray{
254
+ opacity: 0.4;
255
+ }
256
+
257
+
258
+ &--menu{
259
+ display: flex;
260
+ align-items: center;
261
+ color: $white;
262
+ z-index: 99;
263
+ cursor: pointer;
264
+ &-bar{
265
+ width: 61px;
266
+ height: 13px;
267
+ display: flex;
268
+ justify-content: center;
269
+ align-items: center;
270
+ z-index: 90;
271
+
272
+
273
+ &,&::before,&::after{
274
+ content: '';
275
+ display: block;
276
+ height: 3px;
277
+ width: 25px;
278
+ border-radius: 3px;
279
+ background-color: $white;
280
+ position: absolute;
281
+ }
282
+ &::before{
283
+ bottom: 5px;
284
+ }
285
+ &::after{
286
+ top: 5px;
287
+ }
288
+ }
289
+ p{
290
+ margin-left: 39px;
291
+ font-family: $fontM;
292
+ font-size: 1rem;
293
+ font-weight: bold;
294
+ }
295
+
296
+
297
+ &.open .header__nav--menu-bar{
298
+ background-color: rgba(255, 255, 255, 0);
299
+ }
300
+ &.open .header__nav--menu-bar::before{
301
+ transform: rotate(45deg);
302
+ bottom: 0;
303
+ }
304
+ &.open .header__nav--menu-bar::after{
305
+ transform: rotate(-45deg);
306
+ top: 0;
307
+ }
308
+ }
309
+
310
+
311
+ }
312
+ }
313
+
314
+
315
+
316
+
317
+ //NAVIGATION
318
+ .header__hamburger{
319
+ width: 520px;
320
+ height: 100vh;
321
+ background-color:rgba($color: $black, $alpha: 0.9);
322
+ position: absolute;
323
+ right: 0;
324
+ top: 0;
325
+ display: flex;
326
+ justify-content: center;
327
+ align-items: center;
328
+ transform: translateX(100%);
329
+ flex-direction: column;
330
+ transition: all 0.4s ease;
331
+ z-index: 0;
332
+ position: fixed;
333
+ img{
334
+ margin-bottom: 40px;
335
+ }
336
+ &--menu{
337
+ text-align: center;
338
+ li{
339
+ margin-bottom: 30px;
340
+ &:last-of-type{
341
+ margin-bottom: 0;
342
+ }
343
+ a{
344
+ color: $white;
345
+ font-size: 2rem;
346
+ line-height: 1;
347
+ font-weight: bold;
348
+ text-decoration: none;
349
+
350
+ }
351
+ }
352
+ }
353
+ &.open{
354
+ transition: all 0.4s ease;
355
+ transform: translateX(0);
356
+ }
357
+ }
358
+
359
+ //BACKGROUND
360
+ .background{
361
+ background: linear-gradient(180deg,$white 0%,$white 50%,$back 50%,$back 100%);
362
+ margin: 0 calc(50% - 50vw);
363
+ padding-bottom: 80px;
364
+ width: 100vw;
365
+ display: grid;
366
+ grid-template-areas:
367
+ "about about"
368
+ "works culture";
369
+
370
+
371
+ ```
92
372
  ### 試したこと
93
373
 
94
374
  ・別のmixinを指定してみても、解除されない。