响应式CSS:修复了小屏幕中的左侧边栏和页脚冲突
Responsive Css: Fixed Left Sidebar and Footer conflict in small screens
我需要你帮助解决这个复杂的问题。
我有固定的标题,左侧边栏和绝对粘性页脚,如果内容高度小于浏览器的高度,则看不到滚动。
目录
<header></header>
<div class="container">
<div class="aside-left">
<p>sdfsdfs</p>
<p>sdfsdfs</p>
<p>sdfsdfs</p>
<p>sdfsdfs</p>
<p>sdfsdfs</p>
<p>sdfsdfs</p>
<p>sdfsdfs</p>
<p>sdfsdfs</p>
<p>sdfsdfs</p>
<p>sdfsdfs</p>
<p>sdfsdfs</p>
<p>sdfsdfs</p>
</div>
<div class="container-mid"></div>
<div class="push"></div>
<footer></footer>
</div>
CSS
html, body {
height:100%;
background:#ffaaaa;
margin:0;
}
header {
background: #2f3d4c;
overflow: hidden;
position: fixed;
top: 0;
right: 0;
left: 0;
z-index: 600;
width: 100%;
height: 75px;
}
.container {
min-height:100%;
position:relative;
}
.aside-left {
background-color: rgba(255, 255, 255, 0.8);
position: fixed;
left: 0;
top: 75px;
min-height: 100%;
width: 192px;
overflow: hidden;
z-index: 50;
}
.container-mid {
margin-left: 192px;
padding-top: 75px;
}
.push, footer {
height: 55px;
}
footer {
position: absolute;
right: 0;
bottom: 0;
left: 0;
overflow: hidden;
color: #ffffff;
width: 100%;
background: #2f3d4c;
z-index: 100;
}
@media only screen and (max-height: 690px) {
.aside--left {
position: absolute;
margin-bottom: -75px;
float: left;
margin-right: -100%;
}
}
在大屏幕上一切正常,但是当屏幕高度较小,并且左侧边栏的内容高于容器高度时,页脚与左侧边栏的内容重叠,并且某些部分不可见(请参阅小提琴)。
我也需要它在 IE8+ 中工作,并在浏览器高度较小时保持左侧边栏的绝对位置,以便左侧边栏将从上到下倾斜(就像我在媒体查询中所做的那样)。无论如何,解决方案也可以包含JS。
小提琴 : http://jsfiddle.net/frontDev111/dqd2f2dt/1/
如果我
理解正确,你正在尝试实现这样的事情。
我用position: fixed
固定了页脚,并在左侧边栏中添加了overflow: auto
(如果需要显示滚动条,因为您隐藏了它们)以及bottom: 55px
(页脚高度)。
http://jsfiddle.net/dqd2f2dt/4/
(我用测试数据内容填充了它,以测试内容本身如何完成其工作)
我用IE9对此进行了测试,它工作正常。
相关文章:
- 当侧边栏很长时,滚动/固定侧边栏会被切断
- 创建带有侧边栏的谷歌地图
- 如何在显示侧边栏时禁用背景,单击除侧边栏之外的任何位置都会关闭侧边栏
- 在页脚处停止固定侧边栏-防止重叠
- 如何将javascript添加到Wordpress侧边栏中
- 如何正确地将数据发送到打开的Firefox侧边栏
- 如何制作侧边栏以增加其完整长度
- 固定位置侧边栏不滚动-设置内容的高度
- Firefox插件SDK:在侧边栏和主脚本之间通信对象
- 在上下文菜单项单击上显示侧边栏/弹出窗口的最佳方法是什么
- 如何将数组(Google应用程序脚本)返回到HTML侧边栏
- 切换传单侧边栏 V2
- 粘性侧边栏停止在页脚上方 30px
- 使用什么js函数来切换侧边栏
- 指定的侧边栏广播器无效 -- 有效的侧边栏广播器是什么样子的
- 向下滚动页面时在侧边栏中显示部分标题(也许使用 BS scrollspy?
- 火狐侧边栏获取标签网址
- 滚动时固定了侧边栏的计算
- ExtJS 4.1.它们是创建侧边栏菜单的最佳组件(如左面板中的Worpress)
- 可折叠侧边栏/导航菜单