homepage Welcome to WebmasterWorld Guest from 54.198.224.121
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Website
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: DrDoc

CSS Forum

    
Cannot Find StyleSheet
When linking from another page
stu2




msg:4157243
 12:08 am on Jun 23, 2010 (gmt 0)

When I type in the url directly, the stylesheet is found and the page shows correctly. But if I click on a link from another page of the website to the same url I typed-in, it isn't finding the stylesheet and the page isn't showing correctly. What could be causing this?

 

SevenCubed




msg:4157250
 12:29 am on Jun 23, 2010 (gmt 0)

I'm assuming this is a site you are working on and making changes to then testing them so -- try clearing your cache to get the fresh version?

stu2




msg:4157264
 1:01 am on Jun 23, 2010 (gmt 0)

You assume correctly :) But still the same problem :(

SevenCubed




msg:4157300
 2:17 am on Jun 23, 2010 (gmt 0)

How about this...the links you are clicking on from other pages are actual links to the live version of the site rather than the development version. Such as this...

Maybe you are working on dev server localhost/subpage.html but click on a link that is actually coded to the live site www.example.com/subpage.html so you are seeing the live version rather than the dev version -- hehehe, not that I have had that happen to me :p

Major_Payne




msg:4157639
 2:25 pm on Jun 23, 2010 (gmt 0)

Always clear your cache and do a hard refresh (Ctrl + F5) several times to eliminate any possibility of an old cached page being the problem.

If you have used relative paths for your links, you must be sure that you are telling the browser how many directories to backup to and then down to find the file. This is only important if files are in different folders which means you have a more complex directory structure. Absolute paths to folders/files is ok, but relative paths work just fine.

Too bad they don't allow URLs to sites so we can look at the problem page(s).

rocknbil




msg:4157820
 7:17 pm on Jun 23, 2010 (gmt 0)

Relative paths *work* but they always seem to bring up problems like this. If you have

/css/style.css
/modules/classes/autonomy.html
/modules/classes.html

You have to have

../../css/style.css
and
../css/style.css

respectively. Two different links for the same file. But if you use

/css/style.css

in both files, you have both consistency and ease of maintenance, no need to remember how many toothpicks get you back to home. :-) So that's the first thing, adopt this usage when uploading and many of these will go away. Down-side: it doesn't work offline, your computer is not (usually) a web server and has no document root.

O.T.: As for versioning issues ("I updated the style sheet, changes aren't showing") this is often a combination of browser specific issues and the caching settings of the server, both eliminated (well, worked around) by an old trick. Leave your stylesheet file name the same, but use a query string:

href="style.css?version1234"

Change the bolded portion every time you upload, this will trick the browser into thinking it's a new file and will always download the style sheet. Of course this is not something you'd want to do site-wide, just while making mods to specific pages, but it speeds up your development.

stu2




msg:4158017
 12:22 am on Jun 24, 2010 (gmt 0)

OK. I found the problem. I had a trailing backslash after the filename, ie: http://example.com/filename.php/. Removing the backslash solved the problem. Thanks for all your comments.

[edited by: tedster at 3:02 am (utc) on Jun 24, 2010]
[edit reason] Switched to example.com to make the URL more readable [/edit]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved