join: new@juude



get alerts for new articles






CLOSE WINDOW

join: new@juude



get alerts for new articles






CLOSE WINDOW
css: casscading style sheets

CSS3 - 2DTransform & Transitions w3c


intro | transitions | scale | rotate translate | skew | origin | examples | browser support

Transitions


A transition controls the speed and the smoothness of the animation. You can use transitions alone or in conjunction with transforms.
Transitions used alone (which is the case for this example) will not work on some touch devices: tablets and phones etc. The other examples on the following pages include transform.


BUTTON

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;

}