如何将固定位置设置为DIV到页面中

时间:2013-07-11 10:18:55

标签: jquery css html

我有一个像这样的CSS盒子模型: enter image description here

使用jQuery(当一个按钮被隐藏时)我调整了我的Main Content Div的大小,但页脚没有保持在屏幕底部的位置:

enter image description here

我尝试将position: fixed设置为页脚div,但它不会随页面滚动。

我想知道是否有办法定位页脚,无论内容是什么

3 个答案:

答案 0 :(得分:0)

使用css实现此目的

.my_footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
}

答案 1 :(得分:0)

尝试这个

http://jsfiddle.net/8pjdp/1/

CSS

.footer{
background-color:#76D6FF;
position:fixed;
bottom:0;
    width:100%;
    height:100px;
}

HTML

<div class="footer">footer</div>

答案 2 :(得分:0)

试试这个:

.class_name {
    width:100%;
    height:100px;        
    position:fixed;
    bottom:0;
    background-color: #CCC;
}