Html 停止侧边栏在y轴上滚动

Html 停止侧边栏在y轴上滚动,html,css,twitter-bootstrap,Html,Css,Twitter Bootstrap,我的代码中有一个边栏,是从。当页面内容过长时,正文将滚动,但侧边栏不会 这是我希望我的工作方式,但因为我有一个头球,我看到了这个讨厌的效果 HTML: CSS: 如果我能保持边栏不随内容滚动(比如在边栏包装中设置位置:绝对;),并保持边栏的高度与内容相匹配,我认为可以 任何建议都将不胜感激 需要在css表中进行一些修复 #wrapper { padding-left: 0; overflow-y:none; //THIS -> ADD -webkit-transi

我的代码中有一个边栏,是从。当页面内容过长时,正文将滚动,但侧边栏不会

这是我希望我的工作方式,但因为我有一个头球,我看到了这个讨厌的效果

HTML:

CSS:

如果我能保持边栏不随内容滚动(比如在
边栏包装中设置
位置:绝对;
),并保持边栏的高度与内容相匹配,我认为可以


任何建议都将不胜感激

需要在css表中进行一些修复

#wrapper {
    padding-left: 0;
    overflow-y:none; //THIS -> ADD
    -webkit-transition: all 0.5s ease;
    -moz-transition: all 0.5s ease;
    -o-transition: all 0.5s ease;
    transition: all 0.5s ease;
    max-width:100%;  //THIS -> ADD
}
#wrapper.toggled #page-content-wrapper {
    position: absolute;
    margin-right:-250px; //THIS -> REMOVE
}
编辑:

经过几次测试后,以下是您尝试执行的操作:

但是当你在一个小屏幕上时,很少有问题需要解决。。。菜单样式似乎发生了变化(背景为白色而非黑色)和其他一些问题


这是所有关于css的“位置”和大小。。。但我认为这是一个很好的起点。

谢谢你的回答。恐怕这不是我要找的,我想阻止导航条滚动,我只是不明白出了什么问题。。。即使有你的链接。。。导航栏(左)没有滚动^^^请提供更多详细信息…您想将侧边栏保留在包装的左上角吗?当你向下滚动时,你想让导航栏保持向上吗?(所以当你转到页面底部时,它将不可见?)是的,我想知道导航栏是否会保持在左上角。当我向下滚动时,你仍然可以看到左边的边栏颜色。这更接近你想要做的事情,但我实际上不明白为什么在某些屏幕尺寸下不能正常工作。。。
.as-header-wrapper{
    overflow-x: hidden;
}
/*!
 * Start Bootstrap - Simple Sidebar HTML Template (http://startbootstrap.com)
 * Code licensed under the Apache License v2.0.
 * For details, see http://www.apache.org/licenses/LICENSE-2.0.
 */

/* Toggle Styles */
 #wrapper {
    padding-left: 0;
    -webkit-transition: all 0.5s ease;
    -moz-transition: all 0.5s ease;
    -o-transition: all 0.5s ease;
    transition: all 0.5s ease;
}
#wrapper.toggled {
    padding-left: 250px;
}
#sidebar-wrapper {
    z-index: 1000;
    position: fixed;
    left: 250px;
    width: 0;
    height: 100%;
    margin-left: -250px;
    overflow-y: auto;
    background: #000;
    -webkit-transition: all 0.5s ease;
    -moz-transition: all 0.5s ease;
    -o-transition: all 0.5s ease;
    transition: all 0.5s ease;
}
#wrapper.toggled #sidebar-wrapper {
    width: 250px;
}
#page-content-wrapper {
    width: 100%;
    position: absolute;
    padding: 15px;
}
#wrapper.toggled #page-content-wrapper {
    position: absolute;
    margin-right: -250px;
}
/* Sidebar Styles */
 .sidebar-nav {
    position: absolute;
    top: 0;
    width: 250px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.sidebar-nav li {
    text-indent: 20px;
    line-height: 40px;
}
.sidebar-nav li a {
    display: block;
    text-decoration: none;
    color: #999999;
}
.sidebar-nav li a:hover {
    text-decoration: none;
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
}
.sidebar-nav li a:active, .sidebar-nav li a:focus {
    text-decoration: none;
}
.sidebar-nav > .sidebar-brand {
    height: 65px;
    font-size: 18px;
    line-height: 60px;
}
.sidebar-nav > .sidebar-brand a {
    color: #999999;
}
.sidebar-nav > .sidebar-brand a:hover {
    color: #fff;
    background: none;
}
@media(min-width:768px) {
    #wrapper {
        padding-left: 250px;
    }
    #wrapper.toggled {
        padding-left: 0;
    }
    #sidebar-wrapper {
        width: 250px;
    }
    #wrapper.toggled #sidebar-wrapper {
        width: 0;
    }
    #page-content-wrapper {
        padding: 20px;
        position: relative;
    }
    #wrapper.toggled #page-content-wrapper {
        position: relative;
        margin-right: 0;
    }
}
#wrapper {
    padding-left: 0;
    overflow-y:none; //THIS -> ADD
    -webkit-transition: all 0.5s ease;
    -moz-transition: all 0.5s ease;
    -o-transition: all 0.5s ease;
    transition: all 0.5s ease;
    max-width:100%;  //THIS -> ADD
}
#wrapper.toggled #page-content-wrapper {
    position: absolute;
    margin-right:-250px; //THIS -> REMOVE
}