+ -
当前位置:首页 → 问答吧 → (这问题可能对您也有帮助)我想让底部内容的上边距为 60px 为啥在IE8 FF中看不到效果?

(这问题可能对您也有帮助)我想让底部内容的上边距为 60px 为啥在IE8 FF中看不到效果?

时间:2011-04-20

来源:互联网

HTML 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>TEST</title> 

    <style type="text/css">

#my {border:1px solid red; width:600px; height:600px; }

.box { border:1px solid red; width:150px; height:150px; float:left; }

.page { clear:both; border:1px solid red; margin-top:60px; }

    </style>

</head>
<body> 

<div id="my">
    <div class="box">1</div>
    <div class="box">2</div>
    <div class="box">3</div>
    <div class="box">4</div>
    <div class="box">5</div>
    <div class="box">6</div>
    <div class="page">底层内容xxxxxxxxxxxxx</div>
</div>


</body> 
</html> 
       









IE6 IE7 都可以, 为啥IE8 FF 就不行呢? 高手说明原因把

作者: YuNa123   发布时间: 2011-04-20

作者: YuNa123   发布时间: 2011-04-20

这个问题出在 float
.page { clear:both; border:1px solid red; margin-top:60px; } 没有 float:left;
 
前面的样式中都有漂浮。

作者: tan0998   发布时间: 2011-04-20

我要看到边框线100%啊 ,你那样就成了一小段了

作者: YuNa123   发布时间: 2011-04-20

你前面不是设置了div的宽度和高度吗? 
你可以 width:100%;

作者: tan0998   发布时间: 2011-04-20

这个我以前也遇到过
两个办法:
1.给page也添加浮动
2.最后的box和page之间添加一个 "<div style="clear:both;"></div>" 同时page可以不用clear:both;了

......
  <div class="box">6</div>
  <div style="clear:both;"></div>
  <div class="page">底层内容xxxxxxxxxxxxx</div>
......

作者: a8918786   发布时间: 2011-04-20

给page也添加浮动 就是tan0998 给出的办法

作者: a8918786   发布时间: 2011-04-20

热门下载

更多