What is the attribute that controls the rotation direction in css3

WBOY
Release: 2022-04-22 18:32:36
Original
2341 people have browsed it

The attribute that controls the rotation direction of css3 is the transform attribute; this attribute is used in conjunction with the scale() method to control the 2D rotation direction of the element, and this attribute is used in conjunction with the scale3d() method to control the 3D rotation direction of the element. The syntax is "transform:rotate3d(x,y,z)".

What is the attribute that controls the rotation direction in css3

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

What are the attributes of css3 that control the direction of rotation?

In CSS3, you can use the transform function to achieve four types of deformation processing: rotation, scaling, tilting, and movement of text or images.

Browser support

So far: Safari3.1 or above, Chrome8 or above, Firefox4 or above, Opera10 or above browsers support this attribute.

2d rotation

Use the rotate method and add the angle value to the parameter. The angle value is followed by the "deg" text indicating the angle unit. The rotation direction is sequential. clockwise direction.

transform:rotate(45deg);
Copy after login

3D rotation

Use the rotateX method, rotateY method, and rotateZ method respectively to rotate the element around the X-axis, Y-axis, and Z-axis, and add the angle value to the parameters , the angle value is followed by the deg text indicating the angle unit, and the rotation direction is clockwise.

transform:rotateX(45deg);
transform:rotateY(45deg);
transform:rotateZ(45deg);
transform:rotateX(45deg) rotateY(45deg) rotateZ(45deg);
transform:scale(0.5) rotateY(45deg) rotateZ(45deg);
Copy after login

The example is as follows:

<html>
<head>
<style> 
div
{
margin:30px;
width:200px;
height:100px;
background-color:yellow;
/* Rotate div */
transform:rotate(9deg);
-ms-transform:rotate(9deg); /* Internet Explorer */
-moz-transform:rotate(9deg); /* Firefox */
-webkit-transform:rotate(9deg); /* Safari 和 Chrome */
-o-transform:rotate(9deg); /* Opera */
}
</style>
</head>
<body>
<div>Hello World</div>
</body>
</html>
Copy after login

Output result:

What is the attribute that controls the rotation direction in css3

## (Learning video sharing:

css video tutorial)

The above is the detailed content of What is the attribute that controls the rotation direction 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