Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the methods of 2D transformation of CSS style changes

Shulou Source: shulou.com Published: 2022-06-03 00:17:58 10月03日 Update

This article introduces the relevant knowledge of "what are the methods of 2D transformation of CSS style change". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

2D conversion

1)。 Element displacement translate (left, top edge)

Div {transform: translate (50pxMagol 100px);-ms-transform: translate (50pxMagne 100px); / * IE 9 * /-webkit-transform: translate (50pxMagol 100px); / * Safari and Chrome * /-o-transform: translate (50pxMagol 100px); / * Opera * /-moz-transform: translate (50pxMagol 100px); / * Firefox * /}

2)。 Element rotation rotate (Angle)

Div {transform: rotate (10deg);-ms-transform: rotate (10deg); / * IE 9 * /-webkit-transform: rotate (10deg); / * Safari and Chrome * /-o-transform: rotate (10deg); / * Opera * /-moz-transform: rotate (10deg); / * Firefox * /} rotate () scale () skew () matrix ()

3)。 Element scale scale (width multiple, height multiple)

Div {transform: scale (1Mague 2);-ms-transform: scale (1Magne2); / * IE 9 * /-webkit-transform: scale (1Power2); / * Safari and Chrome * /-o-transform: scale (1Magol 2); / * Opera * /-moz-transform: scale (1Mague 2); / * Firefox * /}

4)。 Element flips at a given angle skew (xrem y)

Div {transform: skew (13degmagere 21deg);-ms-transform: skew (13degmagne 21deg); / * IE 9 * /-webkit-transform: skew (13deggery 21deg); / * Safari and Chrome * /-o-transform: skew (13degmagee 21deg); / * Opera * /-moz-transform: skew (13degmagee 21deg); / * Firefox * /}

5)。 Combine all the previous methods into matrix ()

Div {transform:matrix (1.32, 0.32, 0.22, 0.54, 0.65);-ms-transform:matrix (1.32, 0.32, 0.22, 0.54, 0.65); / * IE 9 * /-moz-transform:matrix (1.32, 0.32, 0.42, 0.54, 0.65); / * Firefox * /-webkit-transform:matrix (1.3, 0.32, 0.32, 0.52, 0.54, 0.65). / * Safari and Chrome * /-o-transform:matrix (1.3 Opera * /} defines a matrix of six numbers

6) transition from 2D to 3D

Div {transform:rotate (1deg);-ms-transform:rotate (1deg); / * IE 9 * /-moz-transform:rotate (1deg); / * Firefox * /-webkit-transform:rotate (1deg); / * Safari and Chrome * /-o-transform:rotate (1deg) / * Opera * /} it contains all 2D and 3D methods, and you can individually set the x direction y-axis value of each method, for example: rotate (angle) defines 2D rotation and specifies the angle in the parameters. Test rotate3d definition 3D rotation rotateX (angle) definition 3D rotation rotateY (angle) definition along Y axis 3D rotation rotateZ (angle) definition 3D rotation along Z axis other uses are similar, but there is another difference: perspective (n) defines a perspective view for 3D transformation elements. " What are the methods of 2D transformation of CSS style changes? this is the end of the introduction. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Method element angle style multiple content more knowledge different practical successful almost next number single parameter dilemma reality width that is Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi vpn MySQL OPPO Reno Microsoft