CSS TransformsCSS3 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. CSS 2D TransformsThe CSS 2D transforms are used to re-change the structure of the element as translate, rotate, scale and skew etc. Following is a list of 2D transforms methods:
Supporting browsers
The translate() methodThe 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. See this example: Test it NowThe rotate() methodThe CSS rotate() method is used to rotate an element clockwise or anti-clockwise according to the given degree. Let's take an example to rotate a element by 300. See this example: Test it NowThe scale() methodThe CSS scale() method is used to increase or decrease the size of an element according to the given width and height. Let's take an example to increase the size of an element by increasing its width and height two times. strong>See this example: Test it NowThe skewX() methodThe CSS skewX() method is used to skew an element along the X axis according to the given angle. Let?s take an example to skew an element 30 degrees along the X-axis. See this example: Test it NowThe skewY() methodThe CSS skewY() method is used to skew an element along the Y axis according to the given angle. Let's take an example to skew an element 30 degrees along the Y-axis. See this example: Test it NowThe skew() methodThe CSS skew() method is used to skew an element along with X-axis and Y-axis according to the given angle. Let's take a <div> element and skew it 30 degree along the X-axis and 20 degree along the Y-axis. See this example: Test it NowThe matrix() methodThe CSS matrix() method combines all the six 2D transform methods altogether. It allows you to rotate, scale, translate, and skew elements. Syntax: The parameters of matrix method: matrix(scaleX(),skewY(),skewX(),scaleY(),translateX(),translateY()) See this example: Test it Now Next TopicCSS 3D Transforms |