旋转和位置:绝对(IE8和更低) [英] Rotation and position:absolute (IE8 and lower)
本文介绍了旋转和位置:绝对(IE8和更低)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Internet Explorer 8和更低版本中的旋转有问题。
我可以旋转一个父div,但是子(定位绝对)不与其父旋转。
I have a problem with the rotation in Internet Explorer 8 and lower. I am able to rotare a parent div, but the child (positioned absolute) doesn't rotate with its parent. When I don't position the child absolute, it does the right rotation.
这里是我的代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
.parent
{
background-color: #f00;
position: absolute;
top: 300px;
left: 300px;
width: 500px;
height: 500px;
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.7071067811865476, M12=-0.7071067811865475, M21=0.7071067811865475, M22=0.7071067811865476, sizingMethod='auto expand'); //45deg
}
.child
{
background-color: #0f0;
position: absolute;
top: 150px;
left: 150px;
width: 300px;
height: 300px;
}
</style>
</head>
<body>
<div class="parent">
This is the parent
<div class="child">
This is the child
</div>
</div>
</body>
</html>
当您在IE8中查看此代码时,这是结果
When you view this code in IE8, then this is the result
>
我希望绿色div与红色div具有相同的旋转。
I would like that the green div has the same rotation as the red div.
谢谢!
推荐答案
解决方法:使用类将旋转应用于任何子绝对定位元素:
A workaround: use a class to apply the rotation to any child-absolute-positioned element:
css:
.rotate {
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.7071067811865476, M12=-0.7071067811865475, M21=0.7071067811865475, M22=0.7071067811865476, sizingMethod='auto expand'); //45deg
}
html:
<div class="parent rotate">
This is the parent
<p class="child rotate">
This is the child
</p>
</div>
这篇关于旋转和位置:绝对(IE8和更低)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文