twitter-bootstrap Bootstrap 3:固定右侧边栏

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18409528/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 18:04:24  来源:igfitidea点击:

Bootstrap 3: Fixed Right Sidebar

htmlcsstwitter-bootstrap

提问by Himanshu Yadav

I using one of the Bootstrap 3 exampleto build a sidebar. It works fine. But how can fix its position like navigation bar so that I won't loose it while scrolling down.
I tried adding .uploadSideBarclass to <div class="col-xs-6 col-sm-3 sidebar-offcanvas sidebar-nav-fixed uploadSideBar"like this

我使用 Bootstrap 3示例之一来构建侧边栏。它工作正常。但是如何像导航栏一样固定它的位置,以便我在向下滚动时不会松开它。
我尝试添加.uploadSideBar类来<div class="col-xs-6 col-sm-3 sidebar-offcanvas sidebar-nav-fixed uploadSideBar"喜欢这个

.uploadSideBar {
    margin-top:117px;
    postion:fixed
}

But it did not work.

但它没有用。

采纳答案by Omega

I think you're using the wrong selector. Use this one instead, I've tested it on the link you gave and it works:

我认为您使用了错误的选择器。改用这个,我已经在您提供的链接上对其进行了测试,并且可以正常工作:

.well.sidebar-nav {
position: fixed;
}