if your CSS files are ALWAYS in the folder that maps to http://yourdomain.tld/css_directory/ , you can use an absolute link as follows:
<link rel="stylesheet" href="/css_directory/style.css" />
This is useful if your linking files are in folders nested to levels deeper than 1 from the document root.. note, it can make 'moving things around' easier or more difficult, depending on what you're trying to do..
absolute links can certainly make it more difficult to preview pages that you're working on offline, unless you go REALLY absolute:
<link rel="stylesheet" href="http://yourdomain.tld/css_directory/style.css" />
or run Apache offline, or always work at root or in some kind of dynamically rooted environment, or use a site-aware url rewriting preview tool; like that in Dreamweaver...
MattEvans
Veteran Poster
1,386 posts since Jul 2006
Reputation Points: 522
Solved Threads: 64
Of course, that becomes a headache if your URL changes for some reason, You have to edit every file and change it (just like I had to when my new ISP used "index.htm" instead of "home.htm" for the opening page - a lot of work when you have 300 pages).
I had to change my url 3 times.
1. My old ISP integrated several urls into a master url. They told us we would never have to change it again.
2. The master url created in change #1 contained the computer name "php" (for "personal home pages"). PHP later trademarked that name, and so my old ISP had to change the url again. I converted all of my code to relative addressing at this time.
3. I changed to a new ISP with a cheaper rate. But since they used the different entry page name, I had to change the homepage link in every page.
MidiMagic
Nearly a Senior Poster
3,319 posts since Jan 2007
Reputation Points: 730
Solved Threads: 182