【问题标题】:IE8 rendering of local-files is wrong本地文件的 IE8 渲染是错误的
【发布时间】:2011-02-17 19:27:06
【问题描述】:

似乎 IE8 无法正确呈现本地文件:

考虑这个简单的网页:http://sayang.free.fr/ie8render.html(下面的 html 代码)摘自 w3c 不透明度教程。

本地保存,再次显示:本地文件没有透明度!

这很烦人,尤其是当一个人想要在放置在本地文件中的原型上设计复杂的页面时。

你有解决办法吗?

<html>
  <head>
    <title>IE8 Local File</title>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <meta http-equiv="pragma" content="no-cache" />
    <meta http-equiv="cache-control" content="no-cache" />
    <meta http-equiv="expires" content="-1" />

    <style type="text/css">
    div.background
      {
      width: 500px;
      height: 250px;
      background: url(http://www.w3schools.com/css/klematis.jpg) repeat;
      border: 2px solid black;
      }
    div.transbox
      {
      width: 400px;
      height: 180px;
      margin: 30px 50px;
      background-color: #ffffff;
      border: 1px solid black;
      /* for IE */
      filter:alpha(opacity=60);
      /* CSS3 standard */
      opacity:0.6;
      }
    div.transbox p
      {
      margin: 30px 40px;
      font-weight: bold;
      color: #000000;
      }
    </style>
  </head>
  <body>
    <h2>Save this file locally and open it to see the difference</h2>
    <div class="background">
      <div class="transbox">
        <p>This is some text that is placed in the transparent box. This is some text that is placed in the transparent box. This is some text that is placed in the transparent box. This is some text that is placed in the transparent box. This is some text that is placed in the transparent box.</p>
      </div>
    </div>
  </body>
</html>

【问题讨论】:

    标签: file internet-explorer rendering opacity


    【解决方案1】:

    实际上它现在起作用了:2 年后,微软一定改进了本地文档查看。 它现在提示执行 javascript 并实际执行它,就好像页面是远程的一样。

    非常感谢所有花时间回复的人。 干杯

    【讨论】:

      【解决方案2】:

      &lt;html&gt; 之前(或&lt;!DOCTYPE...&gt;&lt;html&gt; 之间)添加类似的内容:

      <!-- saved from url=(0023)http://www.example.com/ -->
      

      如果存在,Internet Explorer 的行为就好像它已从远程 Web 服务器获取页面,而不是直接从磁盘加载它。

      网址几乎可以是任何您想要的,但括号中的数字必须是网址的长度。

      我不能保证它会起作用,但是如果您仍然对这个老问题感兴趣,请尝试一下 :)

      【讨论】:

      • 有趣。这有帮助吗?如果是这样:为什么?
      • 嗯,它肯定会有所作为。当 Internet Explorer 保存页面(通过文件|保存)时,它会添加类似的注释。我怀疑这是一个可用性问题。您本地计算机上的文件通常会落入不同的安全区域,但这会使保存页面然后尝试在本地打开它却发现它不起作用的用户感到困惑。
      【解决方案3】:

      我希望下面的 URL 可以帮助您解决问题..

      http://css.flepstudio.org/en/css3/opacity-transparency.html

      【讨论】:

      • 谢谢,但这不是如何实现透明度的问题,而是如何使其在本地文件上工作。
      【解决方案4】:

      如果您知道您的代码可以在 IE7 中运行,您可以通过在 &lt;head&gt; 中包含以下标记来强制 IE8 浏览器使用 IE7 标准

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-07-25
        • 1970-01-01
        • 2010-12-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多