What is transform?
- This property is used to apply the 2D or 3D transformation to an element.
- This property allows us to rotate, scale, move, skew, etc., HTML elements.
This will be our boilerplate:
index.html
CSS Transform Values
i) none: This value defines that there is no transformation.
ii) translate(x,y): Defines a 2D translation in x-asis and y-axis.
iii) translateX(x): Defines a translation, using only the value for the X-axis.
iv) translateY(y): Defines a translation, using only the value for the Y-axis
v) scale(x,y): Defines a 2D scale transformation.
vi) scaleX(x): Defines a scale transformation by giving a value for the X-axis.
vii) scaleY(y): Defines a scale transformation by giving a value for the Y-axis.
div:hover { transform: scaleY(4);}
viii) skew(x-angle,y-angle): Defines a 2D skew transformation along the X-axis and the Y-axis.
div:hover { transform: skew(40deg, 34deg);}
viii) skewX(angle): Defines a 2D skey transformation along the X-axis.
div:hover { transform: skewX(24deg);}
viii) skewY(angle): Defines a 2D skey transformation along the Y-axis.
div:hover { transform: skewY(24deg);}
viii) rotate(angle): Defines a 2D rotation, the angle is specified in the parameter.
div:hover { transform: rotate(32deg);}
viii) rotateX(angle): Defines a 3D rotation along the X-axis.
div:hover { transform: rotateX(34deg);}
viii) rotateY(angle): Defines a 3D rotation along the Y-axis.
div:hover { transform: rotateY(34deg);}
Using Transform Properties
index.html
Output:
Write this code in your Code Editor and See the output on the browser window.