日期:2014-05-17  浏览次数:20752 次

html块之间换行
HTML code
<!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;变量)?


------解决方案--------------------

clear:both;
删除