5 replies [Last post]
lukeprog
Offline
Regular
Last seen: 12 years 50 weeks ago
Joined: 2007-12-01
Posts: 14
Points: 0

I uploaded a few pages to my site, lukeprog.com. All of them link to "/style.css" from the header:

No matter what page has that code in the header, it should look in the base directory of the whole domain (lukeprog.com/) for lukeprog.com/style.css, right?

But it isn't. The stylesheet isn't being applied.

See for yourself, and please advise:

http://lukeprog.com
http://lukeprog.com/style.css

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 8 hours 5 min ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9774
Points: 3856

Remove the slash (/), making

Remove the slash (/), making the address relative. :shrug:

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

lukeprog
Offline
Regular
Last seen: 12 years 50 weeks ago
Joined: 2007-12-01
Posts: 14
Points: 0

kk5st: Yes, but I'm going

kk5st:

Yes, but I'm going to use the same navigation code on every page. Let's say the code is on http://lukeprog.com/love/articles/hoax.html

A relative link would then look for the stylesheet at http://lukeprog.com/love/articles/style.css, and of course it won't be there.

I want the code to always look at [domain.com]/style.css, no matter where the header code is.

What I'm doing doesn't do that, even though it should. Why? How can I do that?

Why doesn't "/style.css" look to "http://lukeprog.com/style.css"?

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 8 hours 5 min ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9774
Points: 3856

Arghh! I knew there'd be

Arghh! I knew there'd be some simple explanation.

This:
should be

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 5 years 46 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

As well as the spurious

As well as the spurious forward slash on the rel attribute why have you used the title attribute? if there is a reason fine although I wouldn't name a sheet in that fashion, and it tends to suggest that perhaps you misunderstand the purpose and nature of the title attribute when specifically used in stylesheet links. For a single call to a stylesheet you do not need to set the file as a 'Prefered' one rather than the default 'Persistant'

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

lukeprog
Offline
Regular
Last seen: 12 years 50 weeks ago
Joined: 2007-12-01
Posts: 14
Points: 0

I did what I did because

I did what I did because that's the code I copied from somewhere else. Smile I'm definitely a CSS newbie.

Thanks for the help, guys.