Re: HTML Syntax Question
Michael Adams <[email protected]> Mon, 06 Jun 2011 21:24:51 +1200
| Newsgroups | gmane.org.user-groups.linux.hawkes-bay |
|---|---|
| Message-ID | <[email protected]> |
On Monday 06 June 2011 18:52, Perry Spiller wrote: > > <img src="G:\PerryE\Images\Perry\Harvard Five F Schol Pic.jpg" width="75%" > alt="Flying School Five" /> > > Are the windoze back slashes 'poison' to a relative source attribute? > > From a web search, it seems so. But altering them to a forward slash > didn't help. > > <img src="G:/PerryE/Images/Perry/Harvard Five F Schol Pic.jpg" width="75%" > alt="Flying School Five" /> > This should have worked. Windows should correct the slashes internally. Internet Explorer is forgiving of backslashes but all other browsers require slashes. > Are spaces in filenames valid? > > If not, should they be filled with an under-line character? > > Concatenated? Yes and no. In HTTP requests they get converted to %20 which would make "Harvard Five F Schol Pic.jpg" become "Harvard%20Five%20F%20Schol%20Pic.jpg". Not a pretty site. Generally it is better to either concatenate with camel case "HarvardFiveFScholPic.jpg" or use hyphens. Modern thinking is underscores get missread when a link is underlined during manual entry. > What of drive letters? > > If I move the image to they same root/directory and rename it so this is > the path: C:/HarvardPic.jpg Your queston was about relative paths. Any path that starts with a drive letter is an absolute path in windows. Relative paths start from the current directory. With an absolute path when you upload the files to the web how do you know they are even on windows let alone on the same drive letter. And chances are real good they wont be in the same directory as on your disk. So modern practise is to create a directory called /images in the same place as your HTML files. Then the relative path is images/mypics.jpg. The absolute path is /images/mypics.jpg because / is the root of your server path for html files. The server root is different to the machine root which may be /home/username/www/ , /var/http/ , sites/public_html or anyother directory specified by the server. Anyway by using "images/mypic.jpg" in HTML it will work on both your local computer browser and the Internet. No windows absolute path will work once your HTML is transferred to the Internet. -- Michael