這是一個非常基本的問題,但我的大腦不工作,多次嘗試修復此問題已證明沒有結果。我在父項中使用了overflow:auto,以便它延伸到子項<div>
s的高度。通常這適用於我,這次它不工作:相反,它隱藏了多餘的高度,並放入一個滾動條,所以我可以向下滾動。這不是我想要的行爲。這裏的HTML:當使用溢出時沒有滾動條:自動和div高
<div id="homecasestudy">
<h2 class="homecasestudyheading">Case Study</h2>
<div id="homecasestudyleft"><h3>Lorem</h3><p>Ipsum</p></div>
<div id="homecasestudyright">
<div id="casestudyfrontpic"><img src="uploads/casestudies/1/casestudyex1.jpg" border="0" /></div><div id="paperclip"></div>
<div id="homecasestudyquote">Quote</div>
</div>
</div><!-- homecasestudy -->
而CSS:
#homecasestudy {
width:389px;
min-height:257px;
background:url(../images/casestudybgtop.jpg) #E5E6E7 no-repeat;
padding:13px 0 0 13px;
position:relative;
overflow:auto;
}
#homecasestudyleft {
width:200px;
min-height:130px;
float:left;
margin:20px 0 0 10px;
}
h2.homecasestudyheading {
width:366px;
height:25px;
background:url(../images/casestudytitlebg.jpg) no-repeat;
color:#005BA7;
margin:0;
padding:6px 0 0 8px;
font-size:16px;
}
#homecasestudyright {
float:left;
min-height:180px;
}
#casestudyfrontpic {
width:154px;
height:160px;
background:url(../images/casestudyfrontpic.png) no-repeat;
padding:6px 0 0 9px;
position:absolute;
top:13px;
right:8px;
}
#paperclip {
width:33px;
height:58px;
background:url(../images/paperclip.png) no-repeat;
position:absolute;
top:1px;
right:125px;
}
#homecasestudyquote {
color:#6E7071;
font-size:14px;
font-weight:bold;
width:147px;
position:absolute;
top:180px;
right:10px;
margin:0;
padding:0;
}
'位置:絕對'總是與佈局混亂。正常規則不適用於此。 – 2012-03-19 15:12:08