Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize rotation Technology with function rotate () in CSS3

Shulou Source: shulou.com Published: 2022-06-01 07:37:16 09月30日 Update

This article mainly introduces the CSS3 function rotate () how to achieve rotation technology, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Rotate () function can rotate elements, it mainly operates in two-dimensional space, through an angle parameter value, to set the amplitude of rotation.

If the perspective value is set on the element itself or on the element, then the rotate3d () function can achieve rotation in a 3D space.

Associated attribute: transform-origin.

Take a value

Rotate (); is an angle value in deg, which can be either positive or negative. A positive number rotates clockwise and a negative number rotates counterclockwise.

RotateX (angele), which is equivalent to rotate3d (1pm 0pm 0angle) specifies the X-axis rotation in 3D space.

RotateY (angele), the equivalent of rotate3d, specifies the Y-axis rotation in 3D space.

RotateZ (angele), the equivalent of rotate3d, specifies the Z-axis rotation in 3D space.

Grammar

Transform:rotate ()

CSS

.rotate _ clockwise {

-webkit-transform:rotate (45deg)

-moz-transform:rotate (45deg)

Position:absolute

Left:10px

Top:80px

}

.rotate _ anticlockwise {

-webkit-transform:rotate (- 45deg)

-moz-transform:rotate (- 45deg)

Position:absolute

Left:200px

Top:80px

}

.rotateX {

-webkit-transform:perspective (800px) rotateX (60deg)

-moz-transform:perspective (800px) rotateX (60deg)

Position:absolute

Left:400px

Top:80px

}

.rotateY {

-webkit-transform:perspective (800px) rotateY (60deg)

-moz-transform:perspective (800px) rotateY (60deg)

Position:absolute

Left:600px

Top:80px

}

.rotateZ {

-webkit-transform:perspective (800px) rotateZ (60deg)

-moz-transform:perspective (800px) rotateZ (60deg)

Position:absolute

Left:800px

Top:80px

}

HTML

Rotate 45 degrees clockwise

Rotate 45 degrees counterclockwise

The X axis rotates 60 degrees in 3D space.

The Y axis rotates 60 degrees in 3D space.

Z axis rotates 60 degrees in 3D space

Thank you for reading this article carefully. I hope the article "how to realize the rotation Technology of function rotate () in CSS3" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Dimensional space function article element technology clockwise positive number angle negative number counterclockwise value interest unit parameter at the same time attribute amplitude is in more friends. Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information NVidia Linux macOS MariaDB