2011-03-17 201 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> 
相关问题