html块之间换行

乐哉悠哉 2012-09-28 02:32:29
<!DOCTYPE html>
<html>
<body>

<div id="container" style="width:1200px">

<div id="header" style="background-color: #FFA500;">
<h1 style="margin-bottom:0;">Main Tittle of Web Page</h1>
</div>

<div id="menu" style="background-color: ##FFD700; height:200px; width:100px; float:left;">
<b>Menu</b> <br/> <!--"b emphasizes the text"-->
HTML<br/>
CSS<br/>
JavaScirpt</div>

<div id="content" style="background-color:#EEEEEE; height:200px; width:400px; float:left;">
Content goes here</div>

<div id="footer" style="background-color:#FFA500; clear:both;text-align:center; float:left; ">
Copyright @ W3Schools.com <br/>
<a href="http://www.w3schools.com/html/html_layout.asp" target="_blank">http://www.w3schools.com/html/html_layout.asp</a>
</div>

</div>

</body>
</html>

初学html,不知道问的问题是不是很小白……
这里我想知道id为footer的块为什么自动换行了?
Main Tittle of Web Page是第一行,main和content在第二行,footer为什么自动换到第三行去了(我在值里加上了float:left;变量)?
...全文
160 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
乐哉悠哉 2012-09-28
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 的回复:]


clear:both;
删除
[/Quote]
跪了,我怎么没试这个呢…谢谢红钻大哥。
孟子E章 2012-09-28
  • 打赏
  • 举报
回复

clear:both;
删除

61,115

社区成员

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

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