Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transform Property CSS3 scale but stick at bottom

Did anyone know how to scale an image but stick with bottom? Below is my code, my images scale at middle, but I need them to stick at bottom.

.animation_scale{
position:absolute;
top:150px;
left:55px;
display:block;
z-index:-10;
bottom : 0;}

.animation_scale img{
animation-name:animation_scale;
animation-duration:1s;
animation-timing-function:ease;
animation-delay:0s;
animation-iteration-count:1;
animation-direction:alternate;
animation-play-state:running;
animation-fill-mode: forwards;

    /* Firefox: */
-moz-animation-name:animation_scale;
-moz-animation-duration:1s;
-moz-animation-timing-function:ease;
-moz-animation-delay:0s;
-moz-animation-iteration-count:1;
-moz-animation-direction:alternate;
-moz-animation-play-state:running;
-moz-animation-fill-mode: forwards;

/* Safari and Chrome: */
-webkit-animation-name:animation_scale;
-webkit-animation-duration:1s;
-webkit-animation-timing-function:ease;
-webkit-animation-delay:0s;
-webkit-animation-iteration-count:1;
-webkit-animation-direction:alternate;
-webkit-animation-play-state:running;
-webkit-animation-fill-mode: forwards;}

@keyframes animation_scale {
0%   {
-webkit-transform:  scale(0.2) translate(0px);
-moz-transform:  scale(0.2) translate(0px);
-o-transform:  scale(0.2) translate(0px);}

100% {
-webkit-transform: scale(1.0) skew(0deg) translateY(-10px);
-moz-transform: scale(1.0) skew(0deg) translateY(-10px);
-o-transform: scale(1.0) skew(0deg) translateY(-10px);}}

@-moz-keyframes animation_scale /* Firefox */
{0%   {
-moz-transform:  scale(0.2) translate(0px);}

100% {
-moz-transform:  scale(1.0) translateY(-10px);}}

@-webkit-keyframes animation_scale{ /* Safari and Chrome */

0%   {
-webkit-transform:  scale(0.2) translate(0px);}

100% {
-webkit-transform:  scale(1.0) translateY(-10px);}}
like image 772
lala90 Avatar asked Dec 02 '12 16:12

lala90


People also ask

What does the CSS3 transform property do?

The transform CSS property lets you rotate, scale, skew, or translate an element. It modifies the coordinate space of the CSS visual formatting model.

How do you scale property in CSS3?

The scale() CSS function defines a transformation that resizes an element on the 2D plane. Because the amount of scaling is defined by a vector, it can resize the horizontal and vertical dimensions at different scales. Its result is a <transform-function> data type.

How do I change the anchor point in CSS?

transform-origin lets you re-position the anchor point from the default center of the element. You can set the origin using real units like px or rem . You can also use percentages for X and Y. Or use keywords: left and right for X-axis, top and bottom for the Y-axis, and center for either/or.


2 Answers

Use transform-origin center bottom

Here is working DEMO

like image 82
Gurpreet Singh Avatar answered Oct 26 '22 22:10

Gurpreet Singh


Use transform-origin property on elements on which a transform is applied.

It defines the "center" point of the transformation :

-webkit-transform-origin: 50% 100%;
-moz-transform-origin: 50% 100%;
-o-transform-origin: 50% 100%;
transform-origin: 50% 100%;

or

-webkit-transform-origin: center bottom;
-moz-transform-origin: center bottom;
-o-transform-origin: center bottom;
transform-origin: center bottom;

See more : https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin

like image 23
Armel Larcier Avatar answered Oct 27 '22 00:10

Armel Larcier