Forum Moderators: phranque

Message Too Old, No Replies

stylesheet failing to load

only happens sometimes

         

HelenDev

12:26 pm on Aug 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have had a few reports of the stylesheet not loading and the page subsequently looking wrong.

A hard refresh seems to fix this.

Any idea what causes it to happen? It seems to be accompanied by general slow loading of page.

jbinbpt

12:37 pm on Aug 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's possible that there is a cookie that's causing this.

jb

HelenDev

12:43 pm on Aug 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Cheers jb.

Yes, our site does set a cookie. Is the problem likely to be encountered by people who don't accept cookies, or is it something else?

Also, not sure if it's relevant, but the stylesheet link comes before the link to the js which sets the cookie.

jbinbpt

12:50 pm on Aug 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This was recently discussed here
[webmasterworld.com...]

jb

HelenDev

1:02 pm on Aug 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks jb.

I've had a read, but the cookie on our site isn't anything to do with the stylesheet, it's a separate thing used by our stats package.

I've also tried disabling cookies in FF and the page and stylesheet works fine, so I don't think it can be cookie related.

j4mes

1:58 pm on Aug 2, 2005 (gmt 0)

10+ Year Member



What are you using to call the style sheet? @import or <link ... >? Whichever it is, why not try the other one and see if it has an effect?

HelenDev

2:55 pm on Aug 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The stylesheet is linked. It would be a bit tricky to try switching to @import, as the site is cms controlled and I don't have access to the templates at the moment. Also, this only appears to happen sometimes, so it would be difficult to measure if this helped.

pamount

11:17 am on Aug 28, 2005 (gmt 0)

10+ Year Member



Hi

With the style sheet for the screen do you use:

media="screen" or media="all"

I used to use media="all" for the screen style sheet but I started getting problems similar to what you've had. After I switched to media="screen" the problem went away

The example I use for the screen stylesheet (in xhtml) is:

<link href="css/filename.css" rel="stylesheet" type="text/css" media="screen" />

Have fun

pamount

HelenDev

7:33 am on Aug 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



how about no media attribute at all?

pamount

7:56 am on Aug 30, 2005 (gmt 0)

10+ Year Member



<quote> how about no media attribute at all? </quote>

That might have something to do with your problem. Have you validated your css at [jigsaw.w3.org...]

I've just found in my experience that it's best to explicitly declare the media attribute as I've shown in my example.

I hope that helps

pamount

HelenDev

1:42 pm on Sep 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Cheers pamount.

Have you validated your css

I did a while back, but seems some ms specific markup has crept in. I'll try and remedy this. Does having validation issues with your stylesheet cause it to fail to load on occasion?

it's best to explicitly declare the media attribute

I'll fix this at the next opportunity.

pamount

12:14 am on Sep 7, 2005 (gmt 0)

10+ Year Member



Hello

I don't know if not validating your css will necessarily cause it to fail to load but it's a good thing to do anyway, as well as validating your html.

I just know that before I explicitly declared the media attribute I was having trouble viewing the web site I'd just made. I was looking at it on my computer at work, which is connected to the rest of the network, at my work, over a microwave link. After I explicitly declared the media attribute for the screen stylesheet the problem went away.

If you want to look at the web site I'm talking about its at: [dccc.org.au...] and you can look at the markup behind it. I used the underscore hack in the css so that's why it shows a couple of errors when validating the css.

pamount

pamount

2:08 am on Sep 7, 2005 (gmt 0)

10+ Year Member



Hi

I should have mentioned you can read about the "underscore hack" at [allinthehead.com...]

pamount