Home > Web Front-end > Front-end Q&A > How to set the direction of 3D rotation in css3

How to set the direction of 3D rotation in css3

WBOY
Release: 2022-03-25 15:58:33
Original
2771 people have browsed it

Method: 1. Use the "transform: rotateX(angle);" style to set the element to rotate 3D along the X-axis; 2. Use the "transform: rotateY(angle);" style to set the element to 3D along the Y-axis. Rotation; 3. Use the rotate3d() method to set the element to rotate 3D in any direction.

How to set the direction of 3D rotation in css3

The operating environment of this tutorial: Windows 10 system, CSS3&&HTML5 version, Dell G3 computer.

How to set the direction of 3d rotation in css3

1. Rotate rotateX along the X axis

transform: rotateX(360deg);
Copy after login

The three-dimensional effect is not enough, you can add a perspective perspective, be sure to add it on the parent box of the observation element

It can look like this

2. Rotate along the Y axis rotateY

 transform: rotateY(360deg);
Copy after login

3. Rotate along the Z axis rotateZ

 transform: rotateZ(360deg);
Copy after login

is almost the same as 2D rotation

## 4. It can also be customized Rotation axis

 transform: rotate3d(1, 1, 0, 360deg);
Copy after login

(Learning video sharing:

css video tutorial)

The above is the detailed content of How to set the direction of 3D rotation in css3. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template