CSS background url () not appearing in IE, works in FF/Safari

陌路散爱 提交于 2019-12-06 02:40:11

Seems like this one's been pretty well answered, but I'd like to add:

Works in IE:

background:transparent url('../images/nav/button_bg4.gif') no-repeat;

Works in Firefox and Chrome but does not work in IE:

background:transparent url('../images/nav/button_bg4.gif')no-repeat;

Without knowing IE needs that space (which seems like very marginal formatting) you can waste seeerious time, non?

The order of attributes are wrong as i see. You need to put transparent in the beginning.

background:transparent url('../images/nav/button_bg4.gif') no-repeat;

The background property shorthand order is: colour image repeat position attachment

I suggest you correct to that format providing all properties, and if that fails (and you can confirm that the style is applied) try modifying your image path up and down to see if your base location is what you think it is.

Harun

In Internet Explorer, URL inside CSS is relative to current page. in other browsers, URL inside CSS is relative to the CSS location. It is better to use fix URL for both. If you use Java servlet you can use dummy URL and handle the request in background from the servlet.

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