开发者

CSS hack for multiple background images

I'm using...

background:url(menu-bg.png) repeat-x, url(spot.gif) repeat; 
background:url(spot.gif)\0/;

To create multiple background images in Chrome, Sa开发者_如何学Pythonfari and Firefox. The last directive (using the \0/ is for IE. Its a hack that allows the browsers that support multiple backgrounds to show them, but also allows IE (at least version 8) to show the main background image (spot.gif). Without it, IE8 doesn't render ANY background at all (not sure about IE7).

I don't like to have to use hacks, but this works for now. I dont remember where I found the \0/ hack originally or even why it works. How likely is it that the other browsers begin to recognize the \0/ and render that last directive instead of the multiple backgrounds preceeding it?


No hacking needed:

background:url(spot.gif);
background:url(menu-bg.png) repeat-x, url(spot.gif) repeat; 

This way if the browser understands the second background declaration the first one will be overwritten otherwise the second one is ignored.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜