How can I set a rotation point for an element in CSS?

六月ゝ 毕业季﹏ 提交于 2019-12-01 13:41:50

问题


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?


回答1:


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/




回答2:


Use the transform-origin CSS property:

.class {
    transform-origin: 0 0;
}



回答3:


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;



回答4:


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.



来源:https://stackoverflow.com/questions/6652476/how-can-i-set-a-rotation-point-for-an-element-in-css

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!