I am trying to have an animated background with content but the animated background keeps getting displaced. The only way the animated background is without content which I cant have for my site.
The animation is three vertical lines spaced evenly apart. In each iteration a portion of one vertical line will turn white and fall down the vertical line, for every vertical line. Ive included an image to show what I mean. How can I retain responsiveness and be able to add content placed on top of the animated background(ie an h1 tag and some nav elements)? Also is there a way to have this with css flexbox?
.lines {
position: absolute;
height: 100%;
margin: auto;
width: 90vw;
}
.line {
position: absolute;
width: 1px;
height: 100%;
top: 0;
left: 50%;
background: rgba(255, 255, 255, 0.1);
overflow: hidden;
}
.line::after {
content: "";
display: block;
position: absolute;
height: 15vh;
width: 100%;
top: -50%;
left: 0;
background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, #ffffff 75%, #ffffff 100%);
animation-name: backAnimation;
animation-duration: 7s;
animation-iteration-count: infinite;
animation-fill-mode: forwards;
animation-timing-function: cubic-bezier(0.4, 0.26, 0, 0.97);
}
.line:nth-child(1) {
margin-left: -25%;
}
.line:nth-child(1)::after {
animation-delay: 2s;
}
.line:nth-child(3) {
margin-left: 25%;
}
.line:nth-child(3)::after {
animation-delay: 2.5s;
}
