我有 3 个 DIV,它们位于“包含”DIV 中。容器的宽度为 960px,3 个 DIV 的宽度分别为 45%、10% 和 45%。而且它们都“向左浮动”。够简单吧?
出于某种原因,3 个 DIV 无法正确对齐,即彼此相邻。中间的 DIV 总是在右边的 DIV 之上。我究竟做错了什么?这是一个小提琴来说明我的意思:http: //jsfiddle.net/m2Zzw/2/
HTML:
<div id="mTopContainer">
<div class="mTopInner clearfix">
<div class="leftBlock floatLeft">
<p>[Customer], we have found 126 results for you, which are based on a mortgage of £50,000 over a period of 17 years.</p>
<p>The mortgage will be secured against a property with a value of £100,000, meaning that you will be borrowing 50% of the property's purchase price.</p>
<p>We used your answers to find the lenders more likely to accept you and the rates they are likely to offer you – the rates and lenders may therefore differ from those featured on our homepage. The actual rates offered to you may differ from that shown.</p>
</div>
<div class="middleBlock floatLeft"> </div>
<div class="rightBlock floatLeft">
<h6>Your next step</h6>
<p>Get advice from one of our expert mortgage partners, Sensible Financial Solutions – FTB Prime and take the hassle out of finding the right mortgage for your needs.</p>
<p>Any advice provided is not given either by or on behalf of [company].</p>
</div>
</div>
</div>
CSS:
#mTopContainer { width:100%; height:250px; border:1px solid #BDD7EF; margin-top:15px; }
/*.mTopInner { height:250px; background: url('/Images/Mortgages/restoplady.png') top right no-repeat; } */
.leftBlock { width:45%; }
.middleBlock { width:10%; border-right:1px solid #BDD7EF; margin:0 auto; }
.rightBlock { width:45%; }
.clearfix:before, .clearfix:after { content: " "; display: table; }
.clearfix:after { clear: both; }
/* For IE 6/7 only */
.clearfix { *zoom: 1; }
.floatLeft { float:left; }