3列布局 auto问题

Brokenfango 2011-07-22 10:13:51
大家好 问个问题如下:

比如我有个页面:
<div style="margin-left:auto;margin-right:auto;width:900px;height:auto;">
<div style="float:left;width:300px;background-color:red;height:auto;">
ccccc<br/><br/><br/><br/><br/><br/><br/><br/>
</div>

<div style="float:left;width:300px;background-color:blue;height:auto;">
bbbb<br/><br/><br/>
</div>

<div style="float:left;width:300px;background-color:green;height:auto;">
aaaa<br/><br/><br/>
</div>
</div>

<div id="footer" style="height:100px;background-color:pink;">

</div>

我想实现的效果是中间3列布局 footer 显示在页面底下 可是以上代码footer显示在页面顶部 感到不解 请大侠指教!
...全文
156 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
healer_kx 2011-08-01
  • 打赏
  • 举报
回复
<div style="clear:both"></div>

用这个清楚 float:left or right.
仲兴轩 2011-07-29
  • 打赏
  • 举报
回复
做程序的, 在页面上处理确实都有小问题呀, 呵呵
AsWater 2011-07-26
  • 打赏
  • 举报
回复
别谢谢了,楼主结贴散分
Brokenfango 2011-07-23
  • 打赏
  • 举报
回复
没错 谢谢各位!
dalmeeme 2011-07-23
  • 打赏
  • 举报
回复
需要在footer层前面清除浮动:
......
<div style="clear:both"></div>
<div id="footer" style="height:100px;background-color:pink;">
Acesidonu 2011-07-23
  • 打赏
  • 举报
回复
footer清除一下浮动就行了。
hongmei85 2011-07-23
  • 打赏
  • 举报
回复
<div style="margin-left:auto;margin-right:auto;width:900px;height:auto;">
<div style="float:left;width:300px;background-color:red;height:auto;">
ccccc<br/><br/><br/><br/><br/><br/><br/><br/>
</div>

<div style="float:left;width:300px;background-color:blue;height:auto;">
bbbb<br/><br/><br/>
</div>

<div style="float:left;width:300px;background-color:green;height:auto;">
aaaa<br/><br/><br/>
</div>
</div>
<div style="clear:both;"></div>

<div id="footer" style="height:100px;background-color:pink;">

</div>

61,112

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧