因此,我很難理解浮動可能導致保證金崩潰的情況以及如何影響浮動的位置。我已經包含了一個頁面,它似乎在同一頁面顯示兩種不同的行爲。浮動和保證金崩潰
紅色浮動物似乎位於通過它摺疊的邊緣之前,而下方的藍色浮動物似乎已經通過它們的邊緣摺疊,然後在這些邊緣摺疊之後定位。
任何幫助將不勝感激。
乾杯, 本
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Inheritance Tests</title>
<style>
* {
margin: 0px ;
padding: 0px ;
font-family: courier ;
font-size: small ;
}
.test4 {width: 200px; height: 100px; border-style: solid; border-width: 1px;}
.test5 {border: 1px solid red; width: 200px; height: 50px; float: left; }
.floatedRect {
width: 50px ;
height: 50px ;
float: left ;
background-color: #9cf ;
}
.text {
margin: 10px ;
}
</style>
</head>
<body>
<div class="test4">
Normal Flow
</div>
<div class="test5">
Floated
</div>
<div style="margin-top: 100px">
Has a top margin
</div>
<div style="clear: both">
<div class="floatedRect"></div>
<div class="text">some text</div>
<div class="floatedRect"></div>
<div class="text">some text</div>
<div class="floatedRect"></div>
<div class="text">some text</div>
</div>
</body>
</html>
這很難理解你在問什麼。有沒有你想要解決的特定問題?你能描述一下你在這個例子中會看到什麼嗎? – jessegavin 2009-11-10 01:59:57