【问题标题】:CSS background is not working properly in IE8CSS 背景在 IE8 中无法正常工作
【发布时间】:2013-08-22 01:09:25
【问题描述】:

我有 8 个 html div。我已经用不同的图像设置了所有 div 的背景,除了 IE8 和默认的 android 浏览器中的 2 个 div 之外,所有的都正确显示。如果我为这两个 div 的背景设置任何其他图像,它们也将起作用。但是如果重命名这两个图像并设置它们,它们将不起作用。我很迷惑。下面是代码

     #tabs-8{
        background: url(../images/banner/290/open-house.jpg);
      }
      #tabs-6 {
        background: url(../images/banner/290/our-trainers.jpg);
      }

这些图像有什么问题吗?或者这是 IE8 中的问题。

【问题讨论】:

  • 你能在你的网站上给出这个问题的链接吗?
  • 在 IE8 上看不到任何问题...
  • 能否分享一下屏幕截图。

标签: html css internet-explorer-8 background-image android-browser


【解决方案1】:

对背景使用速记属性可能会导致问题。因此,如果您不指定任何其他值,只需使用 background-image: url('path');

如果你使用速记属性,至少这样使用:

background: url('path') no-repeat;

【讨论】:

    【解决方案2】:

    我发现了这个问题 :) 您的图像无法在 IE8 上加载。如果您在 IE8 的地址栏上输入此链接 http://115.115.80.139/images/banner/290/our-trainers.jpg,您将看不到图像。我认为服务器或图像上的问题。尝试使用其他名称重新保存图像或将其上传到其他主机

    【讨论】:

      【解决方案3】:

      是的,您需要使用background-image: url 属性调用图像。

      <div style="background-image: url(../images/test-background.gif); height: 200px; width: 400px; border: 1px solid black;">Example of a DIV element with a background image:</div>

      【讨论】:

        猜你喜欢
        • 2016-11-21
        • 2017-11-23
        • 1970-01-01
        • 1970-01-01
        • 2012-08-11
        • 2021-04-09
        • 1970-01-01
        • 2015-09-22
        • 2020-10-29
        相关资源
        最近更新 更多