2011-03-17 138 views

回答

12

您可以使用position: absolute

.container 
{ 
    height: 400px; 
    position: relative; 
} 

.adInfoBox1 { 
    padding: 5px 5px 5px 10px; 
    position: absolute; 
    bottom: 0px; 
    width: 457px; 
    background-color: green; 
} 

.adRegularList .categoryList { 
    bottom: 0; 
    height: 16px; 
    position: absolute; 
} 

看到這裏工作的例子:http://jsfiddle.net/hxXJh/5/

0

變化adInfoBox1的CSS:

.adInfoBox1 { 
    float: left; 
    padding: 5px 5px 5px 10px; 
    position: absolute; 
    width: 457px; 
    background-color : green; 
    bottom: 0; 
} 
3

我建議:

.adInfoBox1 { 
    padding: 5px 5px 5px 10px; 
    position: absolute; 
    bottom: 0; /* attaches the element to the bottom */ 
    left: 0; /* attaches the element to the left-side */ 
    right: 0; /* attaches the element to the right-side */ 
    background-color : green; 
} 

以上將給.adInfoBox隱含的100%寬度。這可以通過刪除或修改rightleft聲明進行調整。我刪除了float,因爲使用position: absolute;無論如何都會將該元素從文檔流中取出。

JS Fiddle demo

0

簡單棘手的解決方案。 Div2將位於containerDiv的底部。

<div id="containerDiv"> 
    <div id="div1" style="heigth:90%;"></div> 
    <div id="div2">Content here...</div> 
</div> 
相關問題