Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to slowly transform scale with css?

I currently have it like this:

http://jsfiddle.net/9DGb2/

But for some reason if I change the css to this:

div {
    width: 200px;
    height: 100px;
    background-color: yellow;
}
div:hover {
    -moz-transform: scale(1.05) slow;
    -webkit-transform: scale(1.05) slow;
    -o-transform: scale(1.05) slow;
    -ms-transform: scale(1.05) slow;
    -webkit-transform: scale(1.05) slow;
    transform: scale(1.05) slow;
}

It wont work.

So I am guessing it cant be done this way?

like image 710
MrLars Avatar asked Aug 04 '14 13:08

MrLars


People also ask

How do you slow down transform in CSS?

ease - specifies a transition effect with a slow start, then fast, then end slowly (this is default) linear - specifies a transition effect with the same speed from start to end. ease-in - specifies a transition effect with a slow start. ease-out - specifies a transition effect with a slow end.

How do you use transition scale in CSS?

CSS syntax example for scale Don't forget to add a transition! Without applying transition, the element would abruptly change sizes. Add the transition to the parent selector (not the hover selector). To make the transition smooth on both hover-over/hover-off.


2 Answers

You need to add a transition

-webkit-transition: transform 2s ease-in-out;

JS Fiddle Demo

For more information please consult: Using CSS Transitions

like image 96
speak Avatar answered Jan 27 '23 20:01

speak


transition in other browser

div:hover {
    -moz-transform: scale(1.05);
    -webkit-transform: scale(1.05);
    -o-transform: scale(1.05);
    -ms-transform: scale(1.05);
    -webkit-transform: scale(1.05);
    transform: scale(1.05);

    -webkit-transition: transform 1.05s ease-in-out;
    -moz-transition:transform 1.05s ease-in-out;
    -ms-transition:transform 1.05s ease-in-out;
}
like image 20
Rasel Avatar answered Jan 27 '23 21:01

Rasel