How can I set a rotation point for an element in C

2020-04-01 08:16发布

Is it possible to set the rotation point in CSS? The default rotation point is at the 50%, 50%. I tried:

transform: rotate(230deg); 
rotation-point:90% 90%;

But it does not work... Any suggestions?

4条回答
劳资没心,怎么记你
2楼-- · 2020-04-01 08:50

Use the transform-origin CSS property:

.class {
    transform-origin: 0 0;
}
查看更多
我命由我不由天
3楼-- · 2020-04-01 08:54

just go to http://www.w3schools.com/cssref/css3_pr_rotation-point.asp and read carefully. it says that none of the major browsers support this property.

查看更多
家丑人穷心不美
4楼-- · 2020-04-01 08:58

Try using the transform-origin property instead, rotation-point isn't supported...

For rotating on the top right point of an element (including all targeting):

-webkit-transform-origin: 100% 0;
-moz-transform-origin: 100% 0;
-ms-transform-origin: 100% 0;
-o-transform-origin: 100% 0;
transform-origin: 100% 0;
查看更多
够拽才男人
5楼-- · 2020-04-01 09:07

This will set the rotation pivot point on top-left corner of your element and rotate it:

transform: rotate(-25deg);
transform-origin: 0% 0%;

take a glance at .nav_item_txt class:

http://jsfiddle.net/KHkX7/

查看更多
登录 后发表回答