Home > Web Front-end > CSS Tutorial > How to use css transform-origin attribute

How to use css transform-origin attribute

silencement
Release: 2020-10-21 11:10:28
Original
3147 people have browsed it

How to use css transform-origin attribute

Definition and Usage

The transform-origin attribute allows you to change the position of the element being transformed.

2D transform elements can change the x and y axes of the element. 3D transform elements can also change their Z-axis.

Note: This attribute must be used together with the transform attribute.

Example

Set the base point position of the rotated element:

div
{
transform: rotate(45deg);
transform-origin:20% 40%;

-ms-transform: rotate(45deg); 		/* IE 9 */
-ms-transform-origin:20% 40%; 		/* IE 9 */

-webkit-transform: rotate(45deg);	/* Safari 和 Chrome */
-webkit-transform-origin:20% 40%;	/* Safari 和 Chrome */

-moz-transform: rotate(45deg);		/* Firefox */
-moz-transform-origin:20% 40%;		/* Firefox */

-o-transform: rotate(45deg);		/* Opera */
-o-transform-origin:20% 40%;		/* Opera */
}
Copy after login

Syntax

transform-origin: x-axis y-axis z-axis;
Copy after login

How to use css transform-origin attribute

The above is the detailed content of How to use css transform-origin attribute. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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