Click to See Complete Forum and Search --> : absolute image vs just image link


umair862
05-30-2008, 12:42 AM
Hi Everybody,
I am new to HTML. Can anybody tell me what is the difference between

1) <td><img src="http://www.marketingeye.com.au/cg/newsletter/stop_press/images/CG_stop-press_bank-ad_08.jpg" width="7" height="314" alt=""></td>


and just

2) <td><img src="images/CG_stop-press_bank-ad_08.jpg" width="7" height="314" alt=""></td>


Why image is sometime not diplayed in part 2.

what if we put

3)<td><img src="../images/CG_stop-press_bank-ad_08.jpg" width="7" height="314" alt=""></td>

What does this third part explain?


Waiting for your kind response,

a beginner.

Centauri
05-30-2008, 02:59 AM
The first example is absolute reference which would work from any folder location from any domain, but the server does have a little more work to do resolving the domain to locate the file. The second is a relative reference, and works when the folder that the html file is in also contains the "images" folder. The third example works if both the folder the html is in and the "images" folder are subfolders of another - the ../ means "step back one folder in the tree".

Another relative reference is <img src="/images/CG_stop-press_bank-ad_08.jpg" width="7" height="314" alt=""> where the preceding slash means "relative to the site root" - this will only work from a server and not on your local machine unless you have a web server set up on it.