Is it possible to scale a image from top to bottom, using transform on css? I have this instance here: http://jsfiddle.net/865vgz82/13/
Currently, the image in the class thumbsskin scales from the center, and expands to top, bottom and sides. It'd like to have it fixed on the top, and only scale down and to the sides. Is that possible with only css?
.thumbsskin img {
height: 135px;
width: 320px;
top: 0;
-webkit-transition: all 0.6s ease-in-out;
transition: all 0.6s ease-in-out;
}
.thumbsskin:hover img {
opacity: 0;
-webkit-transform: scale(1.9);
transform: scale(1.9);
transform-origin: top;
}
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.
Definition and Usage The transform-origin property allows you to change the position of transformed elements. 2D transformations can change the x- and y-axis of an element. 3D transformations can also change the z-axis of an element. To better understand the transform-origin property, view a demo.
CSS Demo: skew() This transformation is a shear mapping (transvection) that distorts each point within an element by a certain angle in the horizontal and vertical directions. The effect is as if you grabbed each corner of the element and pulled them along a certain angle.
By default, an element transforms with it's center point as the origin. So in this case it will scale from the center on out. You can change this by setting transform-origin
, like you did.
Simple example:
div {
margin: 3em auto;
width: 50px;
height: 50px;
background: red;
}
div:hover {
transform: scale(1.9);
}
.d2 {
transform-origin: top;
}
<div></div>
<hr />
<div class="d2"></div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With