[英]Wrong positioned element in IE9 with transform: rotate
I need to rotate a text vertically in my HTML5-application. 我需要在HTML5应用程序中垂直旋转文本。
This works in all browsers except IE9 and lower (couldn't test it in IE10 yet): 此功能适用于除IE9及更低版本以外的所有浏览器(尚无法在IE10中对其进行测试):
.badgeWrapper > h3{
-webkit-transform: rotate(-90deg) translate(-100%, 0%);
-webkit-transform-origin: 0 0 0;
-moz-transform: rotate(-90deg) translate(-100%, 0%);
-moz-transform-origin: 0 0 0;
-ms-transform: rotate(-90deg) translate(-100%, 0%);
-ms-transform-origin: 0 0 0;
-o-transform: rotate(-90deg) translate(-100%, 0%);
-o-transform-origin: 0 0 0;
transform: rotate(-90deg) translate(-100%, 0%);
transform-origin: 0 0 0;
width: 140px;
position: absolute;
}
In IE9 (no Quirksmode), the element is rotated but positioned wrong, it's displayed way too low. 在IE9(无Quirksmode)中,元素已旋转但位置错误,显示得太低。 What am I doing wrong? 我究竟做错了什么? The elements parent is position:relative btw. 父元素是position:relative btw。
Thanks! 谢谢!
SOLUTION 解
Sorry to solve my own question, but I had a mistake in giving transform-origin 3 values (which makes it a 3d-transform I suppose) which is not supported by IE9. 很抱歉解决了我自己的问题,但是我给了IE9不支持的变换原点3个值(我想应该是3d变换)时出错了。 Removing the last "0" solved the problem. 删除最后一个“ 0”可以解决问题。
As supposed by @Spudley I post my solution here, so it maybe will help others with the same problem: 正如@Spudley所假设的那样,我在这里发布了我的解决方案,因此它可能会帮助遇到相同问题的其他人:
You must not use 3 values for IE <= 9 as those versions of IE do only support 2D-transformations, 3 values however seem to tell the browser it's an (unsupported) 3D-transform. IE <= 9不能使用3个值,因为那些版本的IE仅支持2D转换,但是3个值似乎告诉浏览器它是(不支持的)3D转换。
So this is wrong: 所以这是错误的:
-ms-transform: rotate(-90deg) translate(-100%, 0%);
-ms-transform-origin: 0 0 0;
and this is right and working: 这是正确且有效的:
-ms-transform: rotate(-90deg) translate(-100%, 0%);
-ms-transform-origin: 0 0;
Hope it helps. 希望能帮助到你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.