问题描述
我遇到了在firefox中加载< li>
的背景图片的问题。
I'm running into a problem with background image of an <li>
loading in firefox.
我的原始代码是:
background: #bdcad7 url(../images/navbg.png) repeat-x;
在Chrome和IE中效果不错,但不是在FF中。
which works well in chrome and IE but not in FF.
background: #bdcad7 url(images/navbg.png) repeat-x;
也可以在IE和chrome中使用,但不能在FF中使用
also works in IE and chrome but not in FF
让它在FF中工作的唯一方法是如果我包含下一个目录级别
The only way to get it working in FF is if I include the next directory level
background: #bdcad7 url(/includes/images/navbg.png) repeat-x;
但不能在其他浏览器中使用。
but that doesn't work in other browsers.
我试过所有的变化,我可以想到 ./
, ../
双引号,使用 background-image
等,不能让它在所有浏览器中工作。相对路径似乎在FF中读取不同(以前从未见过的)
I've tried all variations I can think of ./
, ../
, include quotes, double quotes, use background-image
etc and can't get it to work in all browsers. The relative path just seems to read different in FF (something I've never seen before)
在所有浏览器中都有完整的网址或绝对的路径,但每个在文本编辑器上的3行,所以我想避免它,如果可能。
What works in all browsers is having the full url of the image or an absolute path, but eachtake 3 lines on the text editor so I'd like to avoid it if possible.
任何洞察,为什么firefox给我一个困难的时间将是赞赏。
Any insight as to why firefox is giving me a hard time would be appreciated.
推荐答案
我感谢所有的输入。
考虑到我的能力,我认为这是一个问题,在服务器端沿着目录路径。
I appreciate all the input.To the best of my abilities I figured it's a problem coming somewhere on the server side along the directory path.
我已经加倍和三重检查css,尝试每个变化可能,不能复制测试文档上的错误。
I've doubled and triple checked the css, tried every variation possible and can't duplicate the error on a test document.
我认为唯一的选择是去完全绝对路径,以防有人遇到同样的问题。
I think the only option is to go for the full absolute path in case someone else runs into the same problem.
background:#F1F1F4 url(/dir1/dir2/dir3/dir4/includes/style/images/background.png) top left repeat-x;
这篇关于背景图像路径不工作在firefox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!