1

I am building a website for newer browsers, but I want it to look decent in IE8 too. Everything was OK, until I ran into a problem. I found that background-size is not working in IE8. After some research I was able to find some sort of "hack", but it didn't work for me.

Maybe I am doing something wrong; please take a look at this code and maybe suggest a solution that will fix background sizing in IE8, (preferably a CSS solution).

.logo {
    width: 190px;
    height: 204px;
    background-image: url("../img/logo.png");
    background-repeat: no-repeat;
    background-size: 190px 204px;

    /** This is the so called IE8 hack, but it doesn't seem to work **/

    filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/logo.png',sizingMethod='scale');

    -ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/logo.pn',sizingMethod='scale')";

    /** End of Hack */

    position: absolute;
    display: block;
    z-index: 99;
    margin: -73px 0 0 405px;
}
4

2 回答 2

1

关键是视网膜屏幕,对吧?由于这种屏幕的市场份额并不大,我宁愿先使用“标准”图像,然后在需要时将其替换为高分辨率。

例如,您可以使用Retina.js来实现。

或者您可以简单地使用图像标签。它将在 IE8 上运行。不要忘记定义宽度和高度属性。

<a href="/" class="logo">
  <img src="img/logo.png" width="190" height="204" alt="Bryuvers">
</a>
于 2012-08-16T14:28:51.433 回答
0

IE8 不支持 CSS3 的 Background-size 属性。但是您可以查看此链接http://msdn.microsoft.com/en-us/library/ms532969%28v=vs.85%29.aspx。这可能会对您有所帮助。

于 2013-07-12T12:01:48.630 回答