【发布时间】:2017-08-13 12:49:45
【问题描述】:
我的任务是构建一个侧边栏,其高度等于内容之一。 内容越多,侧边栏越大。
实际上,我的侧边栏等于窗口大小,而不是内容。如果我向下滚动页面,上面没有边栏。
这是我的代码:
HTML:
<div class = "container" style = "height :100%">
<div class = "row" style = "height:100%">
<div class = "col-md-3 hidden-xs hidden-sm" style = "height:100%">
<div class = "sidebar">
.........
</div>
</div>
</div>
</div>
CSS:
html .sidebar,
body .sidebar {
height: 100%;
width: 100%;
background: black;
}
为什么?怎样做才能让它发挥作用?
【问题讨论】: