code on page:
<div id="button">BUTTON</div>
Place the changed color on the hover:
#button:hover{
transition-property: all; also vender code
transition-timing-function: ease; also vender code
transition-duration: 2s; also vender code
background-color: #fa4173;
border-color: #94979f;
color: #ccc;
}
The CSS for the button in its original state needs to include:
transition: all ;
Inorder for it to have animation when the user rolls off the button. without it there would not be any animation it would just abruptly change from one color to the other.
#button{
position: relative;
width: 120px;
height: 80px;
background-color: #94979f;
padding: 40px;
border-width: 10px;
border-color: #fa4173;
border-style: solid;
color: #fff;
text-align: center;
transition-property: all; also vender-code
transition-timing-function: ease; also vender-code
transition-duration: 2s; also vendor-code
}
The CSS for the hover which includes the vender-code
#button:hover{
-moz-transition-property: all;
-moz-transition-timing-function: ease;
-moz-transition-duration: 2s;
-webkit-transition-property:all;
-webkit-transition-timing-function: ease;
-webkit-transition-duration: 2s;
-ms-transition-property: all;
-ms-transition-timing-function: ease;
-moz-transition-duration: 2s;
-o-transition-property: all;
-o-transition-timing-function: ease;
-o-transform-duration: 2s;
transition-property: all;
transition-timing-function: ease;
transition-duration: 2s;
background-color: #fa4173;
border-color: #94979f;
color: #ccc;
}
The smoothness of the animation
You can either state the name of the properties or put all if you want all the changed properties to have a transition