开发者

Changing width/height to a CSS rotated div triggers top/left reposition

I have a <div> that its rotated 66 deg with -webkit-transform(rotate66). When I am performing a resize, width or he开发者_开发百科ight, the div seems to change his top/left coordinates. The actual left/top CSS proprieties do not change though. I think that there is something going wrong in the transform matrix.

Is there any way of making the rotated <div> "stay still" on a width/height resize? On resize should be a left and top prop applied to counter this movement but I can't seems to find the right proportions.

You can see the test here (Webkit Only): http://jsbin.com/iqezoj/4/edit

Thank you


You need to specify a -webkit-transform-origin as well to control where the origin of the transformation. Mozilla documentation quite good on this subject.

Edit -webkit-transform-origin: 100px 50px; moves the point to the middle of the <div> in your example. The default value is 50% 50% which will change depending on the height and width of the <div> which explains why the position was shifting.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜