我試圖讓一個div自動調整大小的高度取決於它的內容:自動高度DIV不工作
<div id = "bar2">
<div id = "breadcrumbs"><p>Home > About</p></div>
<div id = "anterialtitle"><h1>About</h1></div>
<div id = "rightblockant"><img src = "img/about.jpg" alt = "About Image | Alternative Text" width = "300" height = "200"/><p class = "firstpara">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p><br/></div>
<div id = "leftblockant"><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan</p></div>
</div>
</div>
<div id="footer">
<p><a href ="">About</a> | <a href = "">Contact Us</a> | <a href = "">Shipping Information</a> | <a href = "">Returns Policy</a> | <a href = "">Terms & Conditions</a> | <a href = "">Privacy Policy</a></p>
<p>© 2011 <a href="" target="_blank">Everry London</a>. All rights reserved.</p>
</div>
#bar2{
width:960px;
height: auto;
position:relative;
margin:0 auto;
border-left:1px solid #cccccc;
border-right:1px solid #cccccc;
border-bottom:1px solid #cccccc;
border-top:5px solid #313131;
margin-top:15px;
margin-left:4px;
}
然而,這是結果:
www.everry.com/新/ home/about.html
它只封裝h1而不是img或p標籤。爲什麼這是?
這項工作......但爲什麼> ??? – user559142
float將元素從正常頁面流中取出。 – Dev