边距不适用于 Safari(元素位于页面底部)
Margin not working only in Safari (element is at the bottom of the page)
请在最新的 safari 中查看以下 link:
http://www.grupoguion.com/
页脚固定在底部,应该会随着滚动显示出来,所以前面的部分有 margin-bottom 但它不起作用,仅在 Safari 中有效。
其他地方都可以,即使在 I.E.
我试图在 page-wrapper 中添加 overflow: auto,但在所有浏览器中,一切都变得很奇怪,元素消失并出现。
我也读过删除 height: 100% in the body 和 html 可能会解决这个问题,但这对我来说不是一个选项,因为我需要图像来修复浏览器高度。
请问有人有其他可能的解决方案吗?
提前致谢。
您可以添加一个 div 与您的底部大小并使其透明。
html:
<div id='tr-footer'>
</div>
css :
#tr-footer{
height: ?px;
width:100%;
background:transparent;
}
接受的答案太复杂了。考虑这种方法 (taken from another thread):
It's a normal weird behaviour calling margin collapse.
To simply avoid it add overflow: auto;
on the [footer] container.
您的页脚容器可能如下所示:
.footer-container {
overflow: auto;
}
尝试制作元素
display:inline-block
Safari 应该尊重它的尺寸和边距。
请在最新的 safari 中查看以下 link: http://www.grupoguion.com/
页脚固定在底部,应该会随着滚动显示出来,所以前面的部分有 margin-bottom 但它不起作用,仅在 Safari 中有效。 其他地方都可以,即使在 I.E. 我试图在 page-wrapper 中添加 overflow: auto,但在所有浏览器中,一切都变得很奇怪,元素消失并出现。 我也读过删除 height: 100% in the body 和 html 可能会解决这个问题,但这对我来说不是一个选项,因为我需要图像来修复浏览器高度。
请问有人有其他可能的解决方案吗?
提前致谢。
您可以添加一个 div 与您的底部大小并使其透明。 html:
<div id='tr-footer'>
</div>
css :
#tr-footer{
height: ?px;
width:100%;
background:transparent;
}
接受的答案太复杂了。考虑这种方法 (taken from another thread):
It's a normal weird behaviour calling margin collapse. To simply avoid it add
overflow: auto;
on the [footer] container.
您的页脚容器可能如下所示:
.footer-container {
overflow: auto;
}
尝试制作元素
display:inline-block
Safari 应该尊重它的尺寸和边距。