繁体   English   中英

在 Internet Explorer 11 中,页脚显示在屏幕中间而不是底部

[英]Footer is displaying in middle of screen instead of bottom in Internet Explorer 11

在 IE11 中,页脚显示在屏幕中间而不是底部。 在我们将浏览器升级到 IE11 之前,我正在使用下面的 CSS,它是工作文件。

#footer {
    clear: both; 
    height:45px; 
    position: absolute; 
    bottom: 0; 
    left: 0; 
    border: none; 
    width: 100%;
}

注意:- 我的页面有一个选项卡视图,我们在 MVC 中使用布局模板。 请提出一些解决方案。

您的 CSS 没有任何问题。 根据经验,我能预见的唯一问题是您的页脚有一个父元素,其属性position: relative;

这会导致“绝对”定位相对于父级而不是窗口本身。

另外,你可能没有clear:both; . 如果页脚中有浮动元素,只需添加overflow: auto; 这将清除您的浮动!

它现在可能不太相关,因为 IE 似乎越来越不受欢迎,但就垂直定位而言,IE 唯一正确识别的是 div。 因此,在我的情况下似乎有帮助的是将所有元素(包括页脚)强行放入其自己的 div 中:

<div style={{position: "sticky", top: "0px", zIndex: "10"}} >
    <Nav />
</div>
<div>
    <C {...props} {...cProps} />
</div>
<div style={{marginTop: "20px"}}>
    <Footer />
</div>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM