简体   繁体   English

在页面底部显示页脚总是与 Internet Explorer 11 有问题

[英]Show footer at the bottom of the page always problem with Internet Explorer 11

I'm developing an ASP.NET website with Visual Studio 2019 , C# and .NET Framework 4.7我正在使用Visual Studio 2019C#.NET Framework 4.7开发ASP.NET网站

On the masterpage I have inserted this css class because all my pages have vertical scrollbar and I want to show <footer> always at the bottom of the page.在母版页上,我插入了这个css class因为我所有的页面都有垂直滚动条,我想总是在页面底部显示<footer>

On the browsers Google Chrome and Microsoft Edge this css class working correctly, but in browser Internet Explorer 11 the footer text moves along with the web page.在浏览器Google ChromeMicrosoft Edgecss class正常工作,但在浏览器Internet Explorer 11 ,页脚文本随网页一起移动。

How can I do it?我该怎么做?

footer{
 position:fixed;
 bottom:0;
}

<div>
    <footer>
        <p style="font-size:20px">My Company</p>
    </footer>
</div>

It is actualy working fine all browser, just make sure that you set CSS correctly.它实际上在所有浏览器中都可以正常工作,只需确保正确设置 CSS。

  • CSS in style in head head style中的 CSS
  • CSS inline CSS 内联

DEMO:演示:

 <!DOCTYPE html> <html> <head> <title>Page Title</title> <style> .p{ height: 200vh; background:red; } footer{ position:fixed; bottom:0; background: yellow; } </style> </head> <body> <h1>This is a Heading</h1> <p class="p">This is a paragraph.</p> <div> <footer> <p style="font-size:20px">My Company</p> </footer> </div> </body> </html>

Result on IE11 (you can I scrolled because half of title): IE11 上的结果(你可以因为标题的一半而滚动):

在此处输入图片说明

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

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