In css3, you can use the transform attribute with the rotate() function to set the rotation angle of the element. The transform attribute is used to specify the rotation, scaling and other operations of the element. The rotate() function is used to define the 2D rotation of the element. The syntax is " Element {transform:rotate(angle)}".
The operating environment of this tutorial: Windows 10 system, CSS3&&HTML5 version, Dell G3 computer.
The transform attribute applies 2D or 3D transformation to the element. This property allows us to rotate, scale, move or tilt the element.
This attribute can be used with the rotate() function to set the rotation angle.
The rotate() function defines 2D rotation and specifies the angle in the parameters.
The example is as follows:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style> div{ width:100px; height:100px; border:1px solid #000; transform:rotate(45deg); } </style> </head> <body> <div></div> </body> </html>
Output result:
(Learning video sharing: css video tutorial)
The above is the detailed content of How to use rotate to set the rotation angle in css3. For more information, please follow other related articles on the PHP Chinese website!