IE8本地文件渲染错误

发布于 2024-08-31 20:08:42 字数 1802 浏览 6 评论 0原文

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>

It appears that IE8 is not rendering properly a local file:

Consider this simple webpage: http://sayang.free.fr/ie8render.html (html code below) extracted from a w3c tutorial on opacity.

Save it locally and display it again: the local file has no opacity!

That's very annoying, especially when one wants to design complex pages on prototypes placed in local files.

Do you have a solution to that ?

<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>

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

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

发布评论

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

评论(4

友谊不毕业 2024-09-07 20:08:42

之前(或在 之间添加类似的内容) :

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

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

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

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

Add something like this just before the <html> (or between <!DOCTYPE...> and <html>):

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

If that's there, Internet Explorer acts as if it has fetched the page from a remote web server instead of loaded it directly off disk.

The URL can be pretty much whatever you want, but the number in parentheses must be the length of the URL.

I can't guarantee it will work, but give it a try if you're still interested in this old question :)

寂寞美少年 2024-09-07 20:08:42

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

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

If you know that your code works in IE7 you can force IE8 browsers to use IE7 standards by including the following tag inside <head>

 <meta http-equiv="X-UA-Compatible" content="IE=7"> 
信仰 2024-09-07 20:08:42

我希望下面的 URL 能够帮助您解决您的问题。

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

I hope this below URL will help you to solve your issue..

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

嘿哥们儿 2024-09-07 20:08:42

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

非常感谢大家花时间回复。
干杯

Actually it works now: 2 years after, Microsoft must have improved local documents viewing.
It now prompts for executing javascript and actually executes it as if the page was remote.

Many thanks to all of you who have spent some time to reply.
Cheers

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