2010-09-05 86 views

回答

2

幾件事情會在這裏:

  • 您的評論框格擁有100像素
  • 固定高度的所有這個div裏面的元素絕對定位,這需要他們出文檔的正常流動,這會導致包含註釋框div無法包裹/拉伸以適合兒童使用浮點數或僅刪除看起來像第二個<p>的較大內容的位置。用利潤率來此<p>的位置,請參見下面

我能夠改變你的CSS如下來解決這個問題:

#comments .commentBox { /* style.css line 483 */ 
background-color:#DCDCDC; 
/*height:100px; --removed this */ 
min-height:100px; 
position:relative; 
} 

#comments .commentBox .comment-content { /* style.css line 523 */ 
color:#676767; 
font-size:0.91em; 
font-weight:bold; 
line-height:24px; 
margin:52px 92px 0 0; /* -- added this */ 
/* -- removed these 
position:absolute; 
right:95px; 
top:52px; 
width:570px; 
*/ 
} 
+0

非常感謝。你是最棒的。 – faressoft 2010-09-05 22:57:11

0

你想要的clearfix黑客。

添加到您的樣式表:

.clearfix:after { 
    content: "."; 
    display: block; 
    clear: both; 
    visibility: hidden; 
    line-height: 0; 
    height: 0; 
} 

.clearfix { 
    display: inline-block; 
} 

html[xmlns] .clearfix { 
    display: block; 
} 

* html .clearfix { 
    height: 1%; 
} 

然後,添加class="clearfix"到您的DIV(或clearfix到您現有的div類),並應適當清除文本。

+0

有正在使用的有沒有花車,在clearfix黑客是不會幫在這種情況下。 – 2010-09-05 22:01:11

+0

@Moin Zaman,AFAIK,絕對定位的元素流出,然後我認爲clearfix也應該起作用。 – 2010-09-05 22:04:13

+0

@Jesus:不,clearfix hack只適用於浮動元素。也有它的問題。閱讀:http://thinkvitamin.com/design/everything-you-know-about-clearfix-is-wrong/和http://perishablepress.com/press/2008/02/05/lessons-learned-concerning-the -clearfix -css-hack/ – 2010-09-05 22:08:51