-2

I have an 'css' folder and am trying to access an image in there. I am in the parent directory and the images folder is in there. How do I write the path? Nothing I do is working..

<img src="..\images\final2.gif" class="stretch" alt="" />
Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107
stack over
  • 55
  • 6

2 Answers2

0

if you have a structure like :

root
    various web pages
    css
       img

from the css you'd simply have src = "imagename.ext" if you're accessing from the root folder where the html files might be it would be src = "css/imagename.ext"

EDIT: After you edited the question.

the "../" is going up a folder. If you're already in the directory there's no need to include that, you can simply use images/final2.gif

Example from my site:

 background:url('../img/backgrounds/background1.jpg') no-repeat center center fixed;

in this instance the images are in the directory above the one that the css file is in. The parent directory as already mentioned.

null
  • 3,469
  • 7
  • 41
  • 90
0

Try

<img src="images/final2.gif" class="stretch" alt="" />

or

<img src="../images/final2.gif" class="stretch" alt="" />

explanation

<img src="../images/final2.gif">
          __ ______ ________
          |    |       |
          |    |       |___ 3. get the filenamed "final2.gif".
          |    |
          |    |___ 2. go inside "images/" subdirectory.
          | 
          | 
          |____ 1. Go one level up.
Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107