Result
css
html,body{
margin:0;
height:120%;
}
.header{/*ヘッダ部分*/
position:relative;
overflow:hidden;
display:flex;
flex-wrap: wrap;
justify-content: center;
align-items: flex-start;
align-content: flex-start;
height:50vw;
min-height:400px;
max-height:550px;
min-width:300px;
color:#eee;
}
.header:after{/*下部にうっすらグラデーションで影を作る*/
content:"";
width:100%;
height:40%;
position:absolute;
bottom:0;
left:0;
z-index:-1;
background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(27,32,48,1) 100%);
}
.header:before{/*疑似要素に背景画像を指定、常時アニメーションさせつつ、スクロール時は固定*/
content:"";
width:100%;
height:100%;
position:absolute;
top:0;
left:0;
-webkit-backface-visibility: hidden;
-webkit-transform: translateZ(0) scale(1.0, 1.0);
transform: translateZ(0);
background:#1B2030 url(https://unsplash.it/1999/999?image=1063) top center no-repeat;
background-size:cover;
background-attachment:fixed;
animation: grow 60s linear 10ms infinite;
transition:all 0.2s ease-in-out;
z-index:-2
}
@keyframes grow{/*微差で拡大/縮小するアニメーション設定*/
0% { transform:scale(1)}
50% { transform:scale(1.2)}
}
.content{
padding:5% 10%;
text-align:justify
}
html
via
CSS Animated Header