我需要像这样直接加载我的项目DocumentRoot"/var/www/cloud"并正确加载图标。
如何在css文件中给出正确的路径?这就是我迄今为止所尝试的:
background: url(../icons/twitter.png) no-repeat 0 0;
background: url(../../icons/twitter.png) no-repeat 0 0;
background: url(./icons/twitter.png) no-repeat 0 0;
background: url(icons/twitter.png) no-repeat 0 0;
main directory(cloud)
{
folder name (cloud/css)
-custom.css (file name)
-etc..
folder name (cloud/icons)
-fb.png (image file)
-twitter.png (image file)
-etc..
cloud/login.php
cloud/signup.php
cloud/etc
}
希望你们都能理解我的文件夹结构。
如果我给apache提供这样的根路径-DocumentRoot "/var/www/cloud"
,我的图标就不会加载。
如果我给apache提供这样的根路径——DocumentRoot "/var/www/"
——图标会很好地工作。
在我的云中/css/custom.css:
.social-icons li.twitter a {
background: url(../icons/twitter.png) no-repeat 0 0;
//here is my problem . how i give the path here any suggestion
}
但我需要像这个DocumentRoot "/var/www/cloud"
一样直接加载我的项目,并流行地加载图标。
谢谢大家。
如果您还没有在apache中设置您的virtualHost,那么您的网站url仍将保留为localhost。所以你应该尝试使用访问图像
background: url(cloud/icons/twitter.png) no-repeat 0 0;
您还可以将虚拟主机设置为var/www/cloud
,例如端口8001然后您可以使用相同的代码background: url(icons/twitter.png) no-repeat 0 0;
并访问位于http://localhost:8001
的站点