【问题标题】:CSS background-size not working in IE7/8 [duplicate]CSS背景大小在IE7 / 8中不起作用[重复]
【发布时间】:2013-03-23 21:42:25
【问题描述】:

由于某种原因,我的背景大小在 IE 7&8 中不起作用。谁能告诉我为什么。同样在 IE 检查器中, background-size 属性也没有显示出来。

<a href="" class="twitter-custom-follow-button"></a>

.twitter-custom-follow-button {
  float: left;
  width: 96px;
  height: 20px;
  background: url(../img/slices/btns/twitter_follow.png);
  background-size: 96px 20px;
  background-repeat: no-repeat;
}

【问题讨论】:

标签: internet-explorer css internet-explorer-8 internet-explorer-7


【解决方案1】:

那是因为background-size 是一个 CSS3 属性,它在 IE9 之前是 isn't supported

然而,有一个线程建议了一种可能的解决方法: How do I make background-size work in IE?

【讨论】:

    【解决方案2】:

    IE 7/8 不支持 background-size 属性。如果您想要相同的功能,则需要使用 javascript

    【讨论】:

      【解决方案3】:

      IE7/8 不支持background-size。它只在 IE9 中引入。

      如果你想通过这个属性支持 IE7/8,你需要为它使用一个 polyfill 脚本。

      我所知道的唯一支持background-size 的polyfill 是CSS3Pie v2。搏一搏。 (它还增加了对旧 IE 版本中没有的其他几个 CSS 功能的支持)

      【讨论】:

        【解决方案4】:

        使用这个代码

         filter:progid:DXImageTransferform.microsoft.AlphaImageLoader(src='img.jpg',sizingMethod='scale')
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2013-08-01
          • 2016-03-16
          • 1970-01-01
          • 2018-03-22
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多