我正在使用bootstrap,我想让div固定并只滚动内容,比如Facebook如何固定使用右侧边栏和滚动时间线。
我想要和FACEBOOK一样的东西不喜欢堆叠流上的其他主张
我的代码看起来像:
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-8 layout-content-container">
</div>
<div class="col-md-4 layout-content-container">
</div>
</div>
</div>
</body>
</html>
我想让col-md-8滚动,col-md-4固定。
只需使用position:fixed
来附加侧边栏。。。
#sidebar {
height: 100%;
position: fixed;
right: 0;
overflow-y: auto;
}
http://codeply.com/go/oThW0CigtE