Relative links in html?

Okay, I feel completely stupid posting this. I'm not sure if it is classified as a programming issue, but its close enough. My web app uses relative links on the same page:

<img src='images/start.png' />

      

My other page is in the exact same directory, but firebug says the above code is http://localhost/projectFolder/viewtrip.php/images/start.png

. I am confused and I feel like a complete idiot. Am I clearly doing something wrong?

+2


source to share


3 answers


Try:



<img src='./images/start.png' />

      

+1


source


is there a base tag somewhere in HTML?

like this? <base href="http://localhost/myfolder/viewtrip.php" />



(shouldn't make sense, but I can't think of anything else)

ps where in firebug do you see this path?

0


source


When you provide a relative path, you tell the browser that the element is at that location, using the current document as the base. Where is the image directory on your website? If you put / at the front of the path, you tell the browser that the element can be found using the root from your site as the base. The only real value I've found to use. / Or ../ in front of the tracks is correct rendering on preview when editing a file, and sometimes this causes problems (for me) at release time.

0


source







All Articles