Html 网站可在 Chrome / Firefox 中运行,但不能在 Internet Explorer 中运行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15360021/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Website working in Chrome / Firefox but not in Internet Explorer
提问by Mat Metzner
I've recently put up a new website at www.matmetzner.co.uk, it was designed with Chrome
as my default browser, and seems to work fine in Firefox too, but IE
gives me just the background image. I'm a games designer by trade and know a little web design, but I'm certainly no expert in this area as you can probably tell.
我最近在www.matmetzner.co.uk 上建立了一个新网站,它被设计Chrome
为我的默认浏览器,并且在 Firefox 中似乎也能正常工作,但只IE
给了我背景图片。我是一名游戏设计师,对网页设计有所了解,但正如您所知道的,我当然不是这方面的专家。
Can anyone see anything in my source code that might be causing it?
任何人都可以在我的源代码中看到可能导致它的任何内容吗?
Sorry the question is a little vague but because none of it works, it's difficult to see the point of the break and therefore know which specific bit to try and fix.
抱歉,这个问题有点含糊,但因为它都不起作用,所以很难看出中断点,因此知道要尝试修复哪个特定位。
Thanks in advance.
提前致谢。
回答by Chin
To start with I would add below to your head section-
首先,我会在您的头部部分添加以下内容-
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
Which might fix some problems. I'm not going to go into details about what this meta tag does. Please have a look at hereor google it. Also use a CSS resetto bring all the browser defaults to a standard.
这可能会解决一些问题。我不打算详细介绍这个元标签的作用。请看看这里或谷歌它。还可以使用CSS 重置将所有浏览器默认设置为标准。
Then address individual differences and treat them for IE. Also remember to use conditional styles sheets(only if things started getting a bit difficult). Last but not the least remember a website doesn't need to look same in all the browsersas long as it doesn't compromise the usability and purpose of the website.
然后解决个体差异并针对 IE 进行处理。还要记住使用条件样式表(仅当事情开始变得有点困难时)。最后但并非最不重要的是,只要不损害网站的可用性和目的,网站不需要在所有浏览器中看起来都相同。
Hope this helps
希望这可以帮助
回答by Neograph734
You also don't close your style tag
你也没有关闭你的风格标签
<style type="text/css">
<!-- < - BEGIN OF COMMENT
body {
background-image: url(img/grass.jpg);
background-repeat: repeat-y;
}
#website {
position:absolute;
width:211px;
height:24;
z-index:1;
left: 799px;
top: 3px;
}
.style1 {color: #FFFFFF}
</style> < - COMMENT NEVER ENDED, SO TAG NOT READ?
From here IE is actually assuming it is still reading your style tags. Even though you are already presenting content.
从这里 IE 实际上假设它仍在读取您的样式标签。即使您已经在展示内容。