Originally Posted by wanapitei
../x refers to some "x" located in the folder above the current folder of the script being executed.
so in your case
../stylesheet inside the "Doc that doesn't work"
if written in absolute terms refers to
root > folder > stylesheet
I believe you mis-understood the convention. Whenever you use a relative path it starts from the folder the file being executed is in. So
If that were true then if that syntax works for one page, then it should work for another, one step further down. I'm assuming here that when the page looks for the CSS code it starts at the root and proceeds to look down to the address given.
Is this not
a reliable syntax? Or have I misunderstood the ../ convention?
with the stylesheet declaration of
Root > Folder > Doc that works
<link type="text/css" rel="stylesheet" href="../styles.css">
If this is a web site page that you are referring to, it doesn't matter because all web site page paths are declared the same way.
I should note here that I'm working both on my Mac and on my server (not a Mac) where the root is morleychalmers.com. I've set up within that a directory for the forthcoming website, a folder called MostlyTheravada. When the final server and domain is put together, it's the MostlyTheravada directory which will be the root of the website.
Its not mandatory that you develop a new site.
I'd like to preserve the flexibility of relative paths and avoid hard coding absolute paths. Is this not an appropriate setting to develop a new site and domain?
You are correct, using relative paths for a document on the same domain are, in my subjective opinion, the best way to reference. However when a file is moved from folder A to folder B, it requires the developer to redo all of the relative paths due to the move. This is why I like using something called an
absolute relative path. what I mean by that is use the domain as the "root" and go from there..
so from any folder on the website, if you start the relative path with a forward slash (/) it will actually start the link from the domain.
so for the website
with the same exact css external link declared as
would all refer to the file
<link type="text/css" rel="stylesheet" href="/css/stylesheet.css">
I hope I didnt confuse you, but the moral is that if you are working on a web site page, and you wish to reference something using a relative path of the domain, use the forward slash, and it will start the anchor at the document root, which you than can drill down into the correct folder and file that you need