限制页脚滚动

Swe*_*tha 5 html css css3

我有一个Html页面,在页脚中创建了一个菜单栏.目前,整个页面是可滚动的.如何限制页脚的滚动.所以,我正在寻找仅在页面内容上滚动.

页脚菜单栏的代码如下:

#menu-bar {
    height: 50px;
    position: fixed;
    left: 0px;
    bottom: 0px;
    width: 100%;
    margin: 0px;
    padding: 0px;
    line-height: 10px;
    background: #F07C1F;
    z-index: 1000;
}
Run Code Online (Sandbox Code Playgroud)

小智 1

定位元素,就是您正在寻找的...

http://jsfiddle.net/7fuQm/1/

#menu-bar {
    height: 50px;
    position: absolute;
    left: 0px;
    bottom: 0px;
    width: 100%;
    margin: 0px;
    padding: 0px;
    line-height: 10px;
    background: #F07C1F;
    z-index: 1000;
}
#body {
    position: absolute;
    top:0px;
    bottom:50px;    
    left: 0px;   
    overflow:auto;
}
p
{
    margin: 10px;
}
Run Code Online (Sandbox Code Playgroud)