Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fade out after hover is done using CSS

I have have an image which its background color changes when hover.

It takes 1 second to change the colour, but as soon as the courser moves out of the image it changes back without any effect.

How can I have an effect for to fade out the background colour?

CSS:

.latestTrack {
    margin:80px 0 0 0 !important;
}
.latestTrack img {
    float:right;
    margin-right:50px !important;
}
.latestTrack img:hover
    -webkit-transition: all 1s ease;
    -moz-transition: all 1s ease;
    -o-transition: all 1s ease;
    -ms-transition: all 1s ease;
    transition: all 1s ease;
    background-color:#f7710f;

}

HTML:

 <img src="img/SocIco/soundcloud-large.png" />
like image 600
Alex Jj Avatar asked Jun 02 '13 01:06

Alex Jj


People also ask

What is hover transition?

CSS transitions allows you to change property values smoothly (from one value to another), over a given duration.


1 Answers

You forgot the easing out part:

.latestTrack img {
   float:right;
   margin-right:50px !important;
   -webkit-transition: all 1s ease-out;
   -moz-transition: all 1s ease-out;
   -o-transition: all 1s ease-out;
   -ms-transition: all 1s ease-out;
   transition: all 1s ease-out;
}

jsFiddle example here.

like image 144
dsgriffin Avatar answered Sep 19 '22 20:09

dsgriffin