0

几天来,我一直在努力让我的网站在 IE8 上看起来正确(因为愚蠢的银行没有更新他们的浏览器),我已经缩小了一点。

我正在使用 HTML5 标签(IE8 不支持),因为我无法忍受不必要的 div 汤。我正在使用著名的 HTML5shiv 来获取 HTML 元素section,并article在 IE8 中工作。不过,对于这些标记名,IE8 似乎仍然不可靠。

这是一个例子:

<html>
 <head>
  <title>ie8</title>
  <script id="html5shiv_script">/*blah blah*/</script>
  <style>
    section{display:block;}
    article{display:block;background:green;}
    article.first + article{font-size:72px;}
    article.first{color:yellow;}
    article:first-child{background:blue;}
  </style>
 </head>
 <body>
  <section>
   <article class="first">One</article>
   <article>Two</article>
   <article>Three</article>
   <article>Four</article>
   <article>Five</article>
  </section>
 </body>
</html>

链接:http ://www.webnotes.xyz/ie8.html

我找不到任何关于为什么这两种样式没有在 IE8 中应用的任何信息:

article.first + article{font-size:72px;}
article:first-child{background:blue;}

我无法从中推断出任何东西,因为 IE8 应该支持这些选择器,并且在我的个人网站中,我用类切换了这些选择器,但它仍然无法工作。

我通过谷歌搜索找不到任何关于此的信息。谁能解释为什么这些样式在 IE8 中被忽略了?

重要编辑:我刚刚意识到这在 IE9 中也不起作用。

4

2 回答 2

0

I had a problem similar to this working on an intranet site of an insurance company. By default, IE will force intranet site into compatibility mode, thus breaking your selectors.

IE makes assumption about displaying intranet sites (http://someInternalSite/ vs. http://someInternalSite.myCompany.org). That assumption is that intranet sites work best in compatibility mode.

Reference

If this is the case then maybe this Stack Overflow answer can help.

Also, I believe network admins can create a group policy to force IE into compatibility mode. Reference

于 2015-04-13T16:31:51.740 回答
0

我弄清楚为什么我发布的示例不起作用。这是因为我忘记包含一个文档类型。<!DOCTYPE html>在顶部使一切正常。我仍然不知道为什么我正在处理的实际网站不起作用,因为那已经<!DOCTYPE html>......回到了绘图板上!

于 2015-04-13T16:53:06.417 回答