应用了相同样式的网页在不同的浏览器中,将会有不同的显示方式.
<HTML>
<HEAD>
<style>
.leftfloat
{
background-color:#cccccc;
border:2px solid #333333;
width:200px;
height:100px;
float:left;
}
.right
{
background-color:#cccccc;
border:2px solid #333333;
height:100px;
}
.footer{
background-color:#cccccc;
border:2px solid #333333;
clear:both;
}
</style>
</HEAD>
<BODY>
<div class="right">title</div>
<div class="leftfloat">div left float:left</div>
<div class="right">
<div class="leftfloat">div left float:left</div>
<div class="right">div right</div>
<div class="leftfloat">div left float:left</div>
<div class="right">div right</div>
<div class="leftfloat">div left float:left</div>
<div class="right">div right</div>
<div class="leftfloat">div left float:left</div>
<div class="right">div right</div>
</div>
<div class="footer">bottom</div>
</BODY>
</HTML>
以上代码在IE和firefox,oprea中有不同的显示方式.其中IE按预想样式输出,但在其它两种浏览器中有不同的样式输出.
<HEAD>
<style>
.leftfloat
{
background-color:#cccccc;
border:2px solid #333333;
width:200px;
height:100px;
float:left;
}
.right
{
background-color:#cccccc;
border:2px solid #333333;
height:100px;
}
.footer{
background-color:#cccccc;
border:2px solid #333333;
clear:both;
}
</style>
</HEAD>
<BODY>
<div class="right">title</div>
<div class="leftfloat">div left float:left</div>
<div class="right">
<div class="leftfloat">div left float:left</div>
<div class="right">div right</div>
<div class="leftfloat">div left float:left</div>
<div class="right">div right</div>
<div class="leftfloat">div left float:left</div>
<div class="right">div right</div>
<div class="leftfloat">div left float:left</div>
<div class="right">div right</div>
</div>
<div class="footer">bottom</div>
</BODY>
</HTML>