EDIT:
I'm basically trying to achieve the result that this web page demonstrates.
http://codepen.io/Chrislion_me/pen/rVqwbO
I'm pretty new to the whole HTML / CSS world.
What I'm trying to do for a project at uni, is create a home page where there's a picture of a lightning storm in the background, covered by a overlay which is too filter out some of the picture Picture of current website.
Basically, the photo has to remain fixed where it is, so if I scrolled further down the page it doesn't move as such [Stationary Lightning Storm][2].
So this is working perfectly fine, problem is, I can't get my lightning storm to work correctly, the storm is meant to flash a couple of times every ~ 8 seconds-ish.
Depending on the way I play with the code, it usually just goes white and then every ~ 8 seconds it flashes the image and then goes white again.
I'm not sure where I'm going wrong, I've posted part of my code below if that helps - it's just section that hosts the image and the buttons, I can post more CSS if that's needed.
Thanks in advance! :)
HTML
<div id="bg" class="banner flashit">
<p>TEST TEXT</p>
<ul class="actions">
<li><a href="#" class="button special big">Click here</a></li>
</ul>
</div>
CSS
#bg{
padding: 16em 0 13em 0;
background-attachment: fixed;
background-image: url("images/overlay.png"), url("../images/banner.jpg");
background-position: center top;
background-size: cover;
line-height: 1.75;
text-align: center;
z-index: -2;
}
.banner {
padding: 16em 0 13em 0;
background-attachment: fixed;
background-image: url("images/overlay.png"), url("../images/banner.jpg");
background-position: center top;
background-size: cover;
line-height: 1.75;
text-align: center;
-webkit-filter: brightness(3);
filter: brightness(3);
-o-filter: brightness(3);
-moz-filter: brightness(3);
z-index: -1;
}
.flashit{
-webkit-animation: flash ease-out 10s infinite;
-moz-animation: flash ease-out 10s infinite;
animation: flash ease-out 10s infinite;
animation-delay: 2s;
}
@-webkit-keyframes flash {
from { opacity: 0; }
92% { opacity: 0; }
93% { opacity: 0.6; }
94% { opacity: 0.2; }
96% { opacity: 0.9; }
to { opacity: 0; }
}
@keyframes flash {
from { opacity: 0; }
92% { opacity: 0; }
93% { opacity: 0.6; }
94% { opacity: 0.2; }
96% { opacity: 1; }
to { opacity: 0; }
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…