CSS3 supports transform property. This transform property facilitates you to translate, rotate, scale, and skews elements.
Transformation is an effect that is used to change shape, size and position.
There are two type of transformation i.e. 2D and 3D transformation supported in CSS3.
Transform is a process in which elements are visually modified by different transformation method on Web page elements, This makes the webpage even more real and live. We can apply 2D and 3D transformation property on any element. Here we can know about CSS 2D transforms method.
following are the 2D transformation methods
The CSS 2D transforms are used to re-change the structure of the element as translate, rotate, scale and skew etc.
The CSS translate() method is used to move an element from its current position according to the given parameters i.e. X-axis and Y-axis.
Let's take an example to translate a element 50 pixels right, and 100 pixels down from its current position.
This method is use to increase and decrease the size of the elements.Let’s understand with the help of example.
The rotate() method rotates an element clockwise or counter-clockwise according to a given degree.
The skewX() method skews an element along the X-axis by the given angle.
The following example skews the
This method is the combination of all 2D tranformation methods. Here is the syntax of matrix().The matrix() method combines all the 2D transform methods into one.The matrix() method take six parameters, containing mathematic functions, which allows you to rotate, scale, move (translate), and skew elements.The parameters are as follow: matrix(scaleX(),skewY(),skewX(),scaleY(),translateX(),translateY())
The following table lists all the 2D transform properties:
|transform||Applies a 2D or 3D transformation to an element|
|transform-origin||Allows you to change the position on transformed elements|
|matrix(n,n,n,n,n,n)||Defines a 2D transformation, using a matrix of six values|
|translate(x,y)||Defines a 2D translation, moving the element along the X- and the Y-axis|
|translateX(n)||Defines a 2D translation, moving the element along the X-axis|
|translateY(n)||Defines a 2D translation, moving the element along the Y-axis|
|scale(x,y)||Defines a 2D scale transformation, changing the elements width and height|
|scaleX(n)||Defines a 2D scale transformation, changing the element's width|
|scaleY(n)||Defines a 2D scale transformation, changing the element's height|
|rotate(angle)||Defines a 2D rotation, the angle is specified in the parameter|
|skew(x-angle,y-angle)||Defines a 2D skew transformation along the X- and the Y-axis|
|skewX(angle)||Defines a 2D skew transformation along the X-axis|
|skewY(angle)||Defines a 2D skew transformation along the Y-axis|