Home > Article > Web Front-end > What are the properties in css that can achieve rotation effects?
The attribute that can achieve the rotation effect is "transform", which needs to be used together with functions such as rotate(), rotate3d(), rotateX(), rotateY(). The transform attribute is used to apply a 2D or 3D transformation to an element, allowing it to be rotated, scaled, moved or tilted.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
The attribute in css that can achieve rotation effect is "transform".
The transform property applies a 2D or 3D transformation to an element. This property allows us to rotate, scale, move or tilt the element.
The transform attribute can realize the attribute value of rotation:
rotate(angle) defines 2D rotation and specifies the angle in the parameters.
rotate3d(x,y,z,angle) Define 3D rotation.
rotateX(angle) Defines a 3D rotation along the X-axis.
rotateY(angle) Defines 3D rotation along the Y axis.
rotateZ(angle) Defines 3D rotation along the Z axis.
Example:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> div,img,body{ margin: 0; padding: 0; } img.touxiang:hover{ transform: rotate(180deg); -webkit-transform: rotate(180deg); -moz-transform: rotate(180deg); -o-transform: rotate(180deg); -ms-transform: rotate(180deg); } img.touxiang{ margin: 0 auto; display: block; transition: all 0.2s ease-in-out; -webkit-transition: all 0.2s ease-in-out; -moz-transition: all 0.2s ease-in-out; -o-transition: all 0.2s ease-in-out; border-radius:100%; } </style> </head> <body><br><br><br><br> <img src="touxiang.jpg" alt=""/> </body> </html>
Rendering:
(Learning video sharing: css video tutorial )
The above is the detailed content of What are the properties in css that can achieve rotation effects?. For more information, please follow other related articles on the PHP Chinese website!