Forum Moderators: not2easy

Message Too Old, No Replies

programmatically detect if a stylesheet exists

link doesn't load style sheet

         

mongoloid001

2:57 pm on Jul 21, 2003 (gmt 0)

10+ Year Member




Hi I have a wield 'link-not-found' error for a stylesheet. I have two files of exact same level, and both refer to same stylesheet. So theoritically the stylesheet should work for both, but somehow it only worked for one, not the other. (I copied and pasted the link from the working one to the non-working one).

So somehow i missed something somewhere, but i'm stuck. As I have no idea what went wrong.

Any tips would be greatly appreciated!

Nick_W

3:00 pm on Jul 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Post the offending snippet [webmasterworld.com] of code ;)

Nick

netcommr

3:01 pm on Jul 21, 2003 (gmt 0)

10+ Year Member



put in complete urls with domain and all, starting with the http://

mongoloid001

3:15 pm on Jul 21, 2003 (gmt 0)

10+ Year Member



Here is the code:


<link rel="STYLESHEET" href="styles/menu.css">

Nick_W

3:29 pm on Jul 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Right.

So I'm guessing that this page is in a directory and the other is not right? like

page-that-works.html

/some-folder/naughty-page.html

Sound about right?

Try using a root relative url like this:

<link rel="stylesheet" type="text/css" href="/path/to/styles.css">

Notice that I've included the type attribute that is required in modern versions of html and that I've used all lower case letters. If you start a url with a '/' it is always relative to the root of you http doc root (usually something like /public_html/useraccountname/).

Try it...

Nick

mongoloid001

5:32 pm on Jul 21, 2003 (gmt 0)

10+ Year Member



Cool nick. That worked!

Somehow the form redirected the link to a different directory where the action handler sits...