我通常可以通過使用clearfix風格修復所有與浮動有關的問題,但是我無法讓這個工作。我曾嘗試添加一個clearfix樣式到右欄。我寧願不使用單獨的clearfix div。CSS浮動(無法獲得清除工作)
下面的截圖應該說明問題:
HTML:
<div class="two-thirds left">
<!-- Quotes -->
<div class="notepad">
<p class="quote">「I have worked [...]</p>
<span class="who">- Clara Craftsman [...]</span>
</div><!-- .notebook -->
</div><!-- .two-thirds -->
<div class="one-third right clearfix">
p>This should be floating to the right of the notepad, but the Work Experience heading should be below.</p>
</div>
CSS:
/* Floates*/
.left { float:left; }
.right { float:right; }
/* Quotes */
.notepad,
.quote,
.who {
display:block;
font-family:"Neucha",cursive;
font-size:16px;
}
.notepad {
width:409px;
padding-top:25px;
margin-left:30px;
background:url(../img/misc/notepad/notepad-top-big.png) no-repeat;
}
.quote {
width:315px; /* 409px total */
padding:0 28px 24px 66px;
background:url(../img/misc/notepad/notepad-middle-big.png) repeat-y;
}
.who {
width:315px; /* 409px total */
padding:0 28px 48px 66px;
background:url(../img/misc/notepad/notepad-bottom-big.png) no-repeat;
text-align:right;
font-style:italic;
margin-top:-24px;
}
/* Clearfix */
.clearfix:before,
.clearfix:after {
content: " ";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
*zoom: 1;
}
你可以嘗試'。左,.right {溢出:隱藏; }'在你的css – Sean
提供你永遠不想讓內容出現在正常的邊界之外,這應該提供一個修復問題,增加最少的HTML + CSS(我可以看到) – Sean
我也無法看到clearfix,已經嘗試添加到右列 – Sean