如何使网页呈现得像在 IE 兼容模式下运行,即使它不是?

发布于 2024-09-12 11:41:10 字数 350 浏览 2 评论 0原文

在过去的几天里,我一直在拉扯我的头发,因为 div 并没有像它应该的那样延伸到屏幕的整个宽度。在 Firefox 中工作正常,但在 IE(具体为 IE8)中,除非处于兼容模式,否则它将无法正确呈现。 如果页面在兼容模式下正确呈现,则必须有一些技巧或解决方法,使其在不处于兼容模式下时也能正确呈现。

这也给我带来了最后一个问题,如何在没有用户干预的情况下强制页面以兼容模式加载?

我想避免使用兼容模式,因为它会破坏我的 JavaScript,因此如果出现以下情况,我将不得不修改我的 JavaScript:使用兼容模式。

有什么想法吗?

I have been pulling my hair out over the past few days with a div in that does not stretch across the entire width of the screen like it should. Works fine in Firefox, but in IE (IE8 to be specific) it will not render correctly unless it is in Compatibility Mode. If the page renders correctly in Compatibility Mode there has to be some hack or workaround that will also make it render correctly when not in Compatibility Mode.

This also brings up a last resort question for me, how do I force a page to load in Compatibility Mode without user intervention?

I would like to avoid using Compatibility Mode though because it breaks my JavaScript, so I will have to modify my JavaScript if Compatibility Mode is used.

Any thoughts?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一花一树开 2024-09-19 11:41:10

我建议使用 IE8 默认安装的 IE 开发工具栏。它应该可以帮助您解决问题。

添加此元标记还将强制 IE8 模拟 IE7:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

I would suggest using the IE Developer Toolbar that comes installed in IE8 by default. It should help you troubleshoot your issue.

Adding this meta tag will also force IE8 to emulate IE7:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文