css - Internet Explorer 8 显示渐变而不是背景图像

标签 css internet-explorer internet-explorer-8

我有一个奇怪的错误。我正在平铺一个半透明的 1x1 像素黄色 PNG覆盖某些文本的 DIV 中的图像。使用普通 浏览器,一切看起来都应该如此。上面有一些文本和黄色的半透明覆盖层。

This is how it looks in Chrome

但是,在 Internet Explorer 8 中,显示的不是平铺 1x1 PNG 图像,而是渐变 (!)。

This is how it looks in Internet Explorer 8

CSS 相当简单:

.edit_section_overlay {
  position: absolute;
  z-index: 150;

  top: -6px;
  bottom: -6px;
  left: -6px;
  right: -6px;

  border: 1px solid #afad9d;
  background: url('../../images/content/edit/section/overlay/background-color.png') repeat;

  min-height: 34px;
  cursor: move;
}

我以前从未见过这样的错误,Google 也帮不了我……

这是 jsFiddle 中的演示, http://jsfiddle.net/jUVfS/

最佳答案

你的 .png图片需要有更大的尺寸,最小值 1x2而不是 1x1 .

参见:http://nemesisdesign.net/blog/coding/ie8-1x1px-semi-transparent-background-bug/

Internet Explorer 8 doesn't perform the repeat of a 1x1 pixel semi-transparent background image correctly when any other element on the page is using the "-ms-filter" drective for the alpha transparency.

关于css - Internet Explorer 8 显示渐变而不是背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7764751/

相关文章:

Javascript - 如何获取所有浏览器名称?

html - 如何根据大小和类型选择特定的输入元素?

jquery - 如何在 Bootstrap 响应表中保持一行的固定大小?

html - 元素在响应式 header 中的绝对定位

javascript - 带有捕获括号的 .split() 正则表达式在 IE8 中不起作用

javascript - IE8 中的访问被拒绝错误消息

javascript - 在 IE8 上选择日期后,日期选择器不会模糊

css - 为什么我的带有 ASCII 艺术字的网格模板区域不起作用?

javascript - 发生异常时,应用程序停止响应自定义错误页面

html - 文本不会仅在 IE 上显示