旋转和position:absolute (IE8及以下版本)

5
我在Internet Explorer 8及以下版本中遇到了旋转问题。我可以旋转父级div,但绝对定位的子元素不会随着父元素一起旋转。当我不将子元素定位为absolute时,它就可以正确旋转。
以下是我的代码:
<!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中查看此代码时,结果如下所示: enter image description here 我希望绿色div具有与红色div相同的旋转角度。谢谢!

只是出于好奇,你为什么要旋转一个 div 呢?我从来没有找到过它的用途,只是对你的动机感到好奇。 - Freesnöw
我必须制作一个看起来有点像Prezi演示文稿的网站:)。http://prezi.com/ - Vinzcent
哦,好酷的想法。祝你好运 :) - Freesnöw
1个回答

1
一个解决方法:
CSS:
.ie {
       display:none;
}

这个可以正常工作,但当没有旋转时,子元素相对于父元素的位置不同。 - Vinzcent

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接