May 04, 2021 CSS3
CSS3 conversion, we can move, scale, in turn, rotate, and stretch elements.
Next you'll learn about CSS3 2D conversion, and when you learn a new lesson, it's a good idea to do it yourself and click below the code
Give it a tryAllows you to really master this knowledge!
How does it work?
The effect of a transformation that allows an element to change shape, size, and position.
You can convert elements that you use in 2D or 3D.
The numbers in the table support the first browser version number of the property.
The number immediately before -webkit-, -ms- or -moz- is the first browser version number that supports the prefix property.
Attributes | |||||
---|---|---|---|---|---|
transform |
36.0
4.0 -webkit- |
10.0
9.0 -ms- |
16.0
3.5 -moz- |
3.2 -webkit- |
23.0
15.0 -webkit- 12.1 10.5 -o- |
transform-origin
(two-value syntax) |
36.0
4.0 -webkit- |
10.0
9.0 -ms- |
16.0
3.5 -moz- |
3.2 -webkit- |
23.0
15.0 -webkit- 12.1 10.5 -o- |
Internet Explorer 10, Firefox, and Opera support transform properties.
Chrome and Safari require prefix -webkit-version.
Note: Internet Explorer 9 requires the prefix -ms-version.
In this chapter you'll learn about 2D transformation methods:
translate()
rotate()
scale()
skew()
matrix()
You'll learn about 3D transformation in the next chapter.
The translate() method, which moves from the current element position based on the parameters given at the left (X-axis) and top (Y-axis) positions.
The translate value (50px, 100px) is 50 pixels from the left element and 100 pixels from the top.
The rotate() method, an element that rotates clockwise in a given degree. Negative values are allowed, so the element rotates counterclockwise.
The rotate value (30deg) element rotates 30 degrees clockwise.
Scale() method, the size of the element increases or decreases, depending on the width (X-axis) and height (Y-axis) parameters:
Scale (2,4) transforms to 2 times the original size and 4 times its original size.
Contains two parameter values that represent the angle at which the X and Y axes are tilted, which defaults to 0 if the second argument is empty, and a negative argument that tilts in the opposite direction.
skew (30deg, 20deg) is an element that tilts 20 degrees and 30 degrees on the X and Y axes.
The matrix() method and the 2D transformation method are combined into one.
The matrix method has six parameters, including rotation, zoom, move (pan) and tilt functions.
Use the matrix() method to rotate the div element 30 degrees
All conversion properties are listed below:
Property | Describe | Css |
---|---|---|
transform | Elements for 2D or 3D conversion | 3 |
transform-origin | Allows you to change the location of conversion elements | 3 |
Function | Describe |
---|---|
matrix( n , n , n , n , n , n ) | Defines a 2D transformation that uses a matrix of six values. |
translate( x , y ) | Defines a 2D transformation that moves elements along the X and Y axes. |
translateX( n ) | Defines a 2D transformation that moves elements along the X axis. |
translateY( n ) | Defines a 2D transformation that moves elements along the Y axis. |
scale( x , y ) | Defines a 2D zoom transformation that changes the width and height of an element. |
scaleX( n ) | Defines a 2D zoom transformation that changes the width of the element. |
scaleY( n ) | Defines a 2D zoom transformation that changes the height of the element. |
rotate( angle ) | Define 2D rotation and specify the angle in the parameters. |
skew( x-angle , y-angle ) | Defines a 2D tilt conversion along the X and Y axes. |
skewX( angle ) | Defines a 2D tilt conversion, along the X-axis. |
skewY( angle ) | Defines a 2D tilt conversion, along the Y axis. |
Skilled use of CSS3 2D conversion methods, so that you can be at a good time in the design!
CSS3 transform and transform-origin debugging tools