【发布时间】:2013-07-29 08:34:14
【问题描述】:
我正在尝试制作一个侧边栏,这正是我所期待的:
- 顶部固定页眉和固定底部页脚(我不知道“固定”是否正确,但我希望它们不要与侧边栏容器重叠)
- 可滚动的侧边栏容器
我尝试使用 div 的位置,但没有成功。 我也尝试了粘页脚的方法,但效果不太好。 我尝试用谷歌搜索我的问题,但大多数答案都是网站的整个布局。 我需要它在我的侧边栏中工作。
这是我的:jsFiddle
代码有点长,所以我将发布 CSS:
html, body {
height: 100%;
}
#wrap {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -60px;
}
#push, #footer {
height: 60px;
}
.container-fluid {
width: 100%;
height: 100%;
}
#content {
position: absolute;
width: 100%;
bottom: 60px;
top: 42px;
right: 0px;
left: 0px;
padding: 0px;
}
#sidebar {
position:absolute;
width:300px;
height:100%;
}
#sidebar .ul-menu {
margin:0px;
}
#sidenavbar .tabs-left>.nav-tabs>li>a{
margin: 0px;
min-width: 30px;
width: 70px;
-webkit-border-radius: 0px 0 0 0px;
-moz-border-radius: 0px 0 0 0px;
border-radius: 0px 0 0 0px;
border: 0px;
}
.sidebar-tab-content {
background: #FFF;
position: absolute;
height: 100%;
left: 94px;
width:100%;
}
#sidenavbar .tabs-left>.nav-tabs {
border: 0px;
}
#footer {
color: #FFF;
background-color: #666;
}
.side-header, .side-footer {
background: #AAF;
}
h2 {
margin: 0px;
}
【问题讨论】:
-
让我坦率地告诉你,伙计。这是一个难看的布局
-
您想要的输出正是您从小提琴中粘贴的内容。所以我在这里有点困惑
-
是的,我知道,这只是一个示例代码。对我来说更重要的是解决我的问题。
-
你的问题到底是什么。阅读我的第二条评论
-
不,不是,看看页眉和页脚之间的容器。
标签: html css twitter-bootstrap sidebar