因此,我很难理解浮动可能导致保证金崩溃的情况以及如何影响浮动的位置。我已经包含了一个页面,它似乎在同一页面显示两种不同的行为。浮动和保证金崩溃
红色浮动物似乎位于通过它折叠的边缘之前,而下方的蓝色浮动物似乎已经通过它们的边缘折叠,然后在这些边缘折叠之后定位。
任何帮助将不胜感激。
干杯, 本
<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