简体   繁体   English

链接到根级别,然后链接到图像文件夹

[英]linking to root level then images folder

I have a file structure that looks like this: 我有一个看起来像这样的文件结构:

my site structre http://retailsitecommon.afstores.com/Develop/FreshMarket/Screen%20Shot%202012-07-02%20at%2012.12.00%20PM.png 我的网站结构http://retailsitecommon.afstores.com/Develop/FreshMarket/Screen%20Shot%202012-07-02%20at%2012.12.00%20PM.png

I am trying to use root-level links for my images because I have a footer that needs to be used in subfolders of subfolders that has images in it. 我尝试对图像使用根级链接,因为我有一个页脚,该页脚需要在其中包含图像的子文件夹的子文件夹中使用。 For instance, in my styles.css file I am trying background: url('/images/logo.png') no-repeat;, but the image doesn't show up. 例如,在我的styles.css文件中,我尝试使用背景:url('/ images / logo.png')no-repeat ;,但图像未显示。 If I do background: url('../images/logo.png') no-repeat;, the image appears. 如果我做背景:url('../ images / logo.png')no-repeat ;,则会显示图像。 What am I doing wrong? 我究竟做错了什么?

I think this would need to be on a server to work like you would like. 我认为这需要在服务器上才能正常运行。 Try setting up Lamp on PC or Mamp on Mac. 尝试在PC上设置Lamp或在Mac上设置Mamp。

Parent folder for files called from .css file is those where .css file is located. 从所谓的文件父文件夹.css文件是那些.css文件的位置。 When you start file location with (back)slash, you redirect this file to thee file root. 当您使用(反)斜杠开始文件定位时,将此文件重定向到您的文件根目录。

It means: 它的意思是:

/folder-in-root/
./folder-visible-from-stylesheet-file-location/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM