【发布时间】:2011-12-09 06:07:04
【问题描述】:
我在 Internet Explorer 8 及更低版本中遇到了旋转问题。 我可以旋转父 div,但子(绝对定位)不会随父 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 具有相同的旋转。
谢谢!
【问题讨论】:
-
只是出于好奇,你为什么要旋转一个 div?我从来没有发现它的用途,我只是好奇你的动机。
-
我必须创建一个看起来有点像 prezi 演示文稿的网站:)。 prezi.com
-
哦,好主意。好吧,祝你好运:)
标签: html css internet-explorer rotation