html - *仅限 IE6*:没有滚动条可向下推页脚... 相对父级 > 绝对子级 > 相对子级
问题描述
noreply@nosalvation.org
IE7 和更高版本将不显示。
在下面的代码中(如 GIF 示例所示),垂直对齐方式是“ hacky ”,仅在IE6 等旧版浏览器中显示内容。
三个问题:
1.内容与标题重叠。
2.内容不会将页脚向下推。
3.没有滚动条出现。相反,内容会从页面上消失。
IE6 和更早版本的代码:
body {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
html {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
p {
font-size: 21px;
padding: 0;
margin: 0;
text-align: center;
}
#wrapper {
height: 100%;
min-height: 100%;
margin-bottom: -50px;
position: relative;
}
.header {
height: 50px;
background-color: aqua;
}
.vcenter-relative-parent {
height: auto;
overflow: hidden;
position: relative;
}
.vcenter-absolute {
position: absolute;
top: 50%;
}
.vcenter-relative-child {
margin-top: -50px;
position: relative;
top: -50%;
}
#footer {
height: 50px;
background-color: tomato;
}
.push {
height: 50px;
position: relative;
clear: both;
}
<div id="wrapper">
<div class="header">
</div>
<div class="vcenter-relative-parent">
<div class="vcenter-absolute">
<div class="vcenter-relative-child">
<p>
If you shorten the page height...<br>the content appears under the header and footer...<br>and there's no scrollbar.<br>
If you shorten the page height...<br>the content appears under the header and footer...<br>and there's no scrollbar.<br>
If you shorten the page height...<br>the content appears under the header and footer...<br>and there's no scrollbar.<br>
If you shorten the page height...<br>the content appears under the header and footer...<br>and there's no scrollbar.<br>
If you shorten the page height...<br>the content appears under the header and footer...<br>and there's no scrollbar.<br>
If you shorten the page height...<br>the content appears under the header and footer...<br>and there's no scrollbar.<br>
If you shorten the page height...<br>the content appears under the header and footer...<br>and there's no scrollbar.<br>
</p>
<div class="push"></div>
</div>
</div>
</div>
</div>
<div id="footer"></div>
内容如何将页脚向下推以制作滚动条?
(而不是重叠并最终消失)?
解决方案
推荐阅读
- rust - 闭包体的生命周期与传入其中的值不匹配
- elasticsearch - Elastic Search [位置] 映射问题
- reactjs - 如何检测过滤器不工作的错误reactjs
- sql-server - UPDLOCK 获取的锁是原子的吗
- html - 无论如何要针对表中的所有对象并为所有对象声明相同的属性?
- css - 在 Tailwind CSS 网格中跨越多个网格单元
- javascript - 如何检测DOMException(无法在'Node'上执行'removeChild':要删除的节点不是该节点的子节点)使用JS
- matlab - 在两个矩阵中匹配相似的特征谱
- sql - 将 JSON 取消嵌套到 SQL 行
- android - 当微调器需要 XML 字符串数组时,将数组从 Kotlin 设置为 Android 微调器