CSS background-size not working in IE7/8 [duplicate]

谁说我不能喝 提交于 2019-11-28 07:31:17

问题


For some reason my background size is not working in IE 7&8. Can anyone tell me why. Also in the IE inspector, the background-size property is not showing up.

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

回答1:


That's because background-size is a CSS3 property which isn't supported before IE9.

However, there is a thread which suggests a possible workaround: How do I make background-size work in IE?




回答2:


IE 7/8 doesn't support the background-size property .. you will need to use javascript if you want the same functionality




回答3:


IE7/8 do not support background-size. It was only introduced in IE9.

If you want to support IE7/8 with this property, you'll need to use a polyfill script for it.

The only polyfill I know of that supports background-size is CSS3Pie v2. Give it a go. (it also adds support for several other CSS features that aren't in old IE versions)




回答4:


use this one code

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


来源:https://stackoverflow.com/questions/15766772/css-background-size-not-working-in-ie7-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!