作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试制作侧边栏,这正是我所期待的:
我尝试调整 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;
}
最佳答案
谢谢你的想法。我刚刚通过添加这些 css 代码 解决了我的问题:
.side-header {
position: absolute;
top: 0px;
right: 0px;
left: 0px;
}
.side-container {
position: absolute;
bottom: 40px;
top: 40px;
overflow-y: auto;
}
.side-footer {
position: absolute;
bottom: 0px;
left: 0px;
right: 0px;
}
这是 JSFiddle:http://jsfiddle.net/geddemet/XCn7C/
这个社区真的很有帮助。干杯!
关于html - 如何获得页眉固定顶部、容器可滚动和页脚固定底部的侧边栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17877540/
我是一名优秀的程序员,十分优秀!