简体   繁体   English

IE过滤器可将图像设置为背景

[英]IE filter to set a image as background

I use the following code in css in order to set a image as the background of a div, and the image size will be same as the size of div. 我在css中使用以下代码,以将图像设置为div的背景,并且图像大小将与div的大小相同。 it worked fine in home page, but if i go to any inside page 它在首页上工作正常,但如果我转到任何内页
, it just cant load the image, any help will be appreciated. ,它无法加载图像,将不胜感激。 Thanks! 谢谢!

.navLogo{width:100%; height:110px; background-image:url('images/navlogo.png'); background-size: 100% 100%; background: none\9; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='scale',src='template/default/css/images/navlogo.png');}

I tried this Fiddle with Internet Explorer and it shows the image correctly. 我使用Internet Explorer尝试了该提琴 ,它可以正确显示图像。

As you can check I've used two different borders to show that the inner div is the one with the background applied to it. 正如您可以检查的那样,我使用了两个不同的边框来显示内部div是一个带有背景的边框。

It should work even without any IE filter, just use this 即使没有任何IE过滤器,它也应该可以工作,只需使用此

.navLogo{
    background-image:url('http://doc.jsfiddle.net/_downloads/jsfiddle-logo.png');
}

And you should be ok. 而且你应该没事。 Just let us know if you encounter any other problem. 如果您遇到任何其他问题,请告诉我们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM