旋转和位置:绝对(IE8及更低版本)

发布于 2024-12-10 11:36:36 字数 1360 浏览 1 评论 0原文

我在 Internet Explorer 8 及更低版本中遇到旋转问题。 我可以旋转父级 div,但子级(绝对定位)不会随其父级旋转。当我没有将子项绝对定位时,它会进行正确的旋转。

这是我的代码

<!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 中查看此代码时,这就是结果

在此处输入图像描述

我希望绿色 div 与红色 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.

Here is my code

<!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>

When you view this code in IE8, then this is the result

enter image description here

I would like that the green div has the same rotation as the red div.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烟─花易冷 2024-12-17 11:36:37

解决方法:

CSS:

.ie {
       display:none;
}

A workaround:

css:

.ie {
       display:none;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文