Forum Moderators: open

Message Too Old, No Replies

NN4 and Path to Style Sheet

without using absolute URL

         

Conard

10:19 pm on Feb 19, 2003 (gmt 0)

10+ Year Member



This one should be easy for you guys, but it has baffled me for over a year.
I create a style sheet named style2.css, placed in my root directory and call it with this line:
<link rel="stylesheet" type="text/css" href="style2.css">
Now I create a directory and all of the pages in that directory are calling the same style sheet using this link:
<link rel="stylesheet" type="text/css" href="../style2.css">
NN4 for some reason will not pick up the style sheet. It works with all of the other browsers and I know I’m missing something, but what?

Nick_W

10:42 pm on Feb 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmmm.. Blowed if I know!

Have you tried just "/styles.css" - It's root relative, meaning that the slash means 'start from root'.

Sound odd to me, I'll move the post to browsers and see what they have to say ;)

Nick

tedster

10:55 pm on Feb 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I just tested it to be sure, and ../file.css works in my NN4 (Win98se)

Conard

11:04 pm on Feb 19, 2003 (gmt 0)

10+ Year Member



Nick,
Yes I have tried "/styles.css" and NN4 changes it to "../styles.css" and it still wont work.
Geez I thought it was just me not getting it.

Conard

11:33 pm on Feb 19, 2003 (gmt 0)

10+ Year Member



Ok,Tedster was right it does work, except for the back ground image call.
I'm using this in the root style sheet:

body{
background:url(site_files/background.jpg) #FFFFFF;
}
any way around this image not loading?

Nick_W

7:19 am on Feb 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, root relative as above ;)

If the image is not in /subfolder/images but one level above (/images) then when you're calling your sheet from a subdir, the path is wrong....

Nick

bill

8:38 am on Feb 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I've always had to use absolute paths to images for stylesheets intended for NN4.x.

Nick_W

8:50 am on Feb 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Heh, I abandoned NN4 sometime back. Bet you're right bill. That'd work just aswell...

Nick

BlobFisk

12:39 pm on Feb 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think that the reason that your background is not showing on the page within the folder is that you would need an extra ../ before your site_files/background.jpg.

As Bill says you can use absolute pathing (url(http://www.xxx.com/site_files/background.jpg)), or root specific (as Nick mentioned) /site_files/background.jpg.

Either of these will ensure that the path to the background image is constant, regardless of where the file (css or html) using it is located.

Conard

1:49 pm on Feb 20, 2003 (gmt 0)

10+ Year Member



See, I knew it would be easy and it worked just like it is supposed to.
Sometimes I just cant see the forest for the trees and the simple things just slip right past me.

THANKS
Conard