The Transform-origin of transform attribute

Source: Internet
Author: User
definition

The Transform-origin property is used to set the base point of the transform transformation. By default, the base position is the center point of the element. Grammar

Transform-origin:x-axis Y-axis Z-axis

name value Description
X-axis Position (left, center, right)/percent/value X-axis base point coordinates
Y-axis Position (top, center, bottom)/percent/value Y-Axis Base coordinates
Z-axis Numerical Z-axis base coordinates

Note: When you set the base point position numerically , you must take the unit . location

Use location settings to transform the base point code as follows:

. transform-origin-position {
    transform:rotate (45deg);
    Transform-origin:left top;
}

The effect of different position information is as follows (the Mark Red circle is the transformation basis point): left-top

Left-center

Left-bottom

Center-top

Right-top

percentage

Use the percent setting to transform the base point code as follows:

. transform-origin-percent {
    animation:9s rotate infinite;
    transform-origin:25% 25%;
}

The effect is as follows:

As shown above, the red circle is the element that transforms the base point. That is, the x and Y axis values set in the code are 25%. Numerical

Use numeric settings to transform the base point code as follows:

. transform-origin-number {
    transform:rotate (45deg);
    transform-origin:100px 0;
}

Note that the value must be followed by a unit.

The effect is as follows:

The position of the red circle in the figure is the position of the x axis 100px.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.