View Full Version : HREF to CSS Inconsistency, Performance?

10-13-2002, 05:11 AM
I have several subdirectories under one directory. That directory is two directories under the directory that holds my style sheet. If I code my href as in the first statement below, it works in one of the subdirectories, but not in the others, even though they are all immediate subdirectories of the same folder. A work around I used instead was to code the statement as shown in the second line below, with full url. Does coding the full url mean a performance impact?


echo"<HTML><HEAD><<LINK REL=\"stylesheet\" HREF=\"../../../basic2.css\" >";

echo"<HTML><HEAD><LINK REL=\"stylesheet\" HREF=\"http://www.site.com/basic2.css\"> ";

10-13-2002, 05:23 AM
echo"<HTML><HEAD><<LINK REL=\"stylesheet\" HREF=\"../../../basic2.css\" >";

So the page the above is shown on is http://www.yoursite.com/one/two/three/page or
http://www.yoursite.com/one/two/page ?

If it's the first url, then the above css link should work

If you're changing from one directory level to the ither, why not use this?

Put this in a separate file and include the file on the top of every page

$style = 'http://www.yoursite.com/basic.css';

And then use this as your style link

echo '<html><head><link rel="stylesheet" href="'.$style.'">';

10-13-2002, 06:01 AM

All these subdirectories have the same immediate parent and the statement worked from one of them, but not the others. Shouldn't happen, but does... Yes, the url approach is fine. The only question I have is whether that approach involves any additional overhead.


10-14-2002, 10:31 AM
no overhead. but you can simplify it like this:

echo"<HTML><HEAD><LINK REL=\"stylesheet\" HREF=\"/basic2.css\"> ";