DIV+CSS这段代码在IE6和IE7,火狐,运行效果不一样.

来源:百度知道 编辑:UC知道 时间:2024/06/16 14:39:55
<style type="text/css">
div { width : 100px; height: 100px; border: thin solid red;}

blockquote { width: 125px; height: 100px;
margin-top: 50px; margin-left: 50px;
border: thin dashed black}
cite { display: block;
text-align: right;
border: none}
p { margin: 0;}
</style>

<div>
<blockquote>
<p>some text long enough to make it interesting.</p>
<cite>- anonymous</cite>
</blockquote>
</div>

你把这段代码运行一下 看看
在IE6和IE7的效果绝对不一样
还有火狐浏览器

我要求把代码给我修改完整了,在线等

修改后的代码(IE6、IE7、FF正常,有注释):

<!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>
<title>Crazy</title>
</head>
<body>
<style type="text/css">
div { width : 100px; height: 100px; border: thin solid red;position:relative;
}

blockquote {
width:125px; /*大于父窗口的宽度,在IE6里会将父容器撑大,而在IE7和FF里不会变*/
height:100px;
margin-top:50px;
margin-left:50px;
border:thin dashed black;
position:absolute; /*将它设置成绝对定位,这样父对象就不会再被他撑大了*/
}

cite { display: block;
text-align: right;
border: none}