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

How to set the direction of 3D rotation in css3

WBOY
WBOY Original
2022-03-25 15:56:37 2685browse

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);

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);

3. Rotate along the Z axis rotateZ

transform: rotateZ(360deg);

is almost the same as 2D rotation

## 4. It can also be customized Rotation axis

transform: rotate3d(1, 1, 0, 360deg);

(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!

Statement:
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
Previous article:What is border in css3 Next article:What is border in css3