I want to apply fadeIn and fadeOut effect on element or any other div tag with 3second dlay. answer CSS based only not use jQuery. thanks
Asked
Active
Viewed 5,770 times
-5

Azhar
- 693
- 9
- 22
1 Answers
2
I'll give you the benefit of the doubt, but you can find an answer with minimal effort searching either SO or online...but here goes...a quick example of a fade out...reverse for fade in:
Demo Fiddle
HTML
<div></div>
CSS
div {
height:100px;
width:100px;
background:red;
}
div:hover {
-webkit-animation:fadeOut 1s;
-webkit-animation-delay:3s;
-webkit-animation-fill-mode:forwards;
-moz-animation:fadeOut 1s;
-moz-animation-delay:3s;
-moz-animation-fill-mode:forwards;
animation:fadeOut 1s;
animation-delay:3s;
animation-fill-mode:forwards;
}
@-webkit-keyframes fadeOut {
from {
opacity:1;
}
to {
opacity:0;
}
}
@-moz-keyframes fadeOut {
from {
opacity:1;
}
to {
opacity:0;
}
}
@keyframes fadeOut {
from {
opacity:1;
}
to {
opacity:0;
}
}

SW4
- 69,876
- 20
- 132
- 137
-
not use any hover effect... first it adds fadein animation and delay of 5second and then fadeout animation,,, – Azhar Nov 20 '14 at 11:47
-
**I want to make like** http://jsfiddle.net/azhrhussain/n4mKw/2526/embedded/result/ – Azhar Nov 20 '14 at 12:09
-
My hedding goes here...
`– Azhar Nov 20 '14 at 11:25
`.fadein{ opacity:0; animation:fadein 4s infinite; } @keyframes fadein{ from{opacity:0;} to{opacity:1;} } .fadeout{ opacity:1; animation:fadeout 3s infinite; animation-delay:5s; } @keyframes fadeout{ from{opacity:1;} to{opacity:0;} }` – Azhar Nov 20 '14 at 11:33