不工作的CSS中的图像相对路径 [英] relative path not working for images in css
问题描述
我有以下文件结构:
C:/ WAMP / myproject的/管理/ Webroot公司/图像
我有一个index.php文件躺在它调用的header.inc.php文件位于同一文件夹中的管理文件夹内。的header.inc.php具有以下code -
I have an index.php file lying inside the admin folder which calls a header.inc.php file lying in the same folder. header.inc.php has the following code-
<td align="left" valign="top" class="header-bg">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
的index.php呼吁通过以下code CSS文件(css.css):
index.php calls a css file (css.css) through the following code:
<link href="<?php echo (WS_DIR_CSS); ?>/css.css" rel="stylesheet" type="text/css" />
CSS的主要表现在以下位置: C:/ WAMP / myproject的/管理/ Webroot公司/ CSS
在CSS文件有它具有以下code类:
The css files has a class which has the following code:
.header-bg {
background:url(../images/header_bg.jpg) left top repeat-x;
height:77px;
}
图片 header_bg.jpg 未显示在浏览器中。帮助别人?
The image header_bg.jpg is not being displayed in the browser. Help anyone?
推荐答案
图像相对的CSS包含
如果你的形象住在这里...
if your image lives here...
/images
和你的CSS住在这里...
and your css lives here...
/somefolder/css/style.css
那么规则将
background-image:url( ../../images/header_bg.jpg );
您可以检查使用Firebug的元素?是否有可能被重新路由请求的任何重写规则?你有在图像上读取的权限?
Can you check the element using firebug? Are there any rewrite rules that may be rerouting the request? Do you have read permissions on the image?
这篇关于不工作的CSS中的图像相对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!