Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS Webkit Transition - Fade out slowly than Fade in

This is what I have:

.box{
    background:#FFF;
    -webkit-transition: background 0.5s;
}

.box:hover{
    background:#000;
}

But this appends to both onmouseover and onmouseout actions, but isn't there a way to control them? Something like:

-wekbkit-transition-IN: background 1s;
-webkit-transition-OUT: background 10s;
like image 619
Adam Halasz Avatar asked Apr 14 '11 19:04

Adam Halasz


People also ask

What is Webkit transition duration?

The transition-duration CSS property sets the length of time a transition animation should take to complete. By default, the value is 0s , meaning that no animation will occur.

How do you fade out in CSS?

The fade transition in CSS is a stylistic effect that lets elements such as background, image, or text gradually disappear or appear on a web page. To apply a fade-out effect on an element, you need to use either the animation or transition property in CSS.

What is fade transition?

A fade in is an opening shot or transition technique film editors use to ease viewers into new imagery, rather than using a sudden cut from scene to scene.


1 Answers

Just redifine your transition in the over pseudo element.

.box{
    background: white;
    -webkit-transition: background 5s;
}
.box:hover{
    background: olive;
    -webkit-transition: background 1s;
}

Look my http://jsfiddle.net/DoubleYo/nY8U8/

like image 62
Yoann Avatar answered Sep 27 '22 23:09

Yoann