In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to set the rotate rotation point in css3". In the daily operation, I believe many people have doubts about how to set the rotate rotation point in css3. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to set the rotate rotation point in css3". Next, please follow the editor to study!
In css3, you can use the "transform-origin" attribute to set the rotation point when the rotate rotates the element, which is used to change the position of the transformation element, you can change the center point of the rotation, and the syntax is "transform-origin: x-axis y-axis z rotation;".
The operating environment of this tutorial: windows10 system, CSS3&&HTML5 version, Dell G3 computer.
How to set the rotate rotation point by css3
2D rotation refers to rotating the element clockwise or counterclockwise in a two-dimensional plane. (the experience is better when used with transition)
Syntax format:
Transform:rotate (degrees)
Note:
Rotate is followed by degrees, and the unit is deg, for example, transform:rotate (180deg), which means rotation of 180 degrees.
When the angle is positive, it rotates clockwise; when it is negative, it rotates counterclockwise, such as transform:rotate (180deg) and transform:rotate (- 180deg).
The center point of the default rotation is rotated at the center point of the element.
Change the center point of the rotation:
Transform-origin
We can set where the element is rotated.
The transform-Origin attribute allows you to change the location of the transformation element.
A 2D transformation element can change the X and Y axes of an element. 3D converts the element, and you can also change the Z axis of the element.
Syntax format:
Transform-origin: x-axis y-axis z-axis
Note:
The following parameters x and y are separated by spaces, not commas
The center point of the xy default conversion is the center point of the element (50%)
You can also set pixels or orientation nouns to xy, such as top bottom left right center.
Examples are as follows:
123#div1 {position: relative; height: 200px; width: 200px; margin: 100px; padding:10px; border: 1px solid black;} # div2 {padding:50px; position: absolute; border: 1px solid black; background-color: red; 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 and Chrome * /-webkit-transform-origin:20% 40%; / * Safari and Chrome * /} HELLO
Output result:
At this point, the study on "how to set the rotate rotation point in css3" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.