This is a discussion on [OT] CSS file size limit within the PHP Language forums, part of the PHP Programming Forums category; This is quite OT. But, thought that many people here might have came across such situation. I have used an ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
This is quite OT. But, thought that many people here might have came
across such situation. I have used an external CSS file for a web page--at least for now (before optimization) the size is quite big--50k. The page is now and then behaves strange. That is, sometimes, only few styles are get applied to the page. This happens often especially in FF; in IE also it happens occasionally. Initially thought it's a parsing bug or so--but validators don't throw any errors. Sometimes if we clear the cache, it works--but not always this solution works. I have also approached the designer, she suspects the file size. According to her, the styles in the bottom of the file is making trouble often (but not all times). Does anyone came across similar situations? Is there any file size limit in CSS? Couldn't find any thing similar in Google yet. TIA. -- <?php echo 'Just another PHP saint'; ?> Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/ |
|
|||
|
R. Rajesh Jeba Anbiah wrote:
> Does anyone came across similar situations? Is there any file size > limit in CSS? Couldn't find any thing similar in Google yet. TIA. Not really, although 50K is rather big for a CSS. Optimalization springs to mind. Regardless of the size, this sounds like a server problem. I don't think FF nor IE will wait indefinitely for a CSS file to load. What you could try to debug your problem is a) include the CSS in the requesting file rather than using a <link /> attribute or b) use gz compression, to see if this improves loading. JW |
|
|||
|
Janwillem Borleffs wrote:
> R. Rajesh Jeba Anbiah wrote: > > Does anyone came across similar situations? Is there any file size > > limit in CSS? Couldn't find any thing similar in Google yet. TIA. > > Not really, although 50K is rather big for a CSS. Optimalization springs to > mind. Thanks for your reply. I can shrink the code, but would like to know why this happens--only random part of the styles act strange or not applied. > Regardless of the size, this sounds like a server problem. I don't think FF > nor IE will wait indefinitely for a CSS file to load. As far as I looked, this doesn't look like a server problem. I'm also working on the local server alone. FF definitely seems to have some issues--noticed even in other sites: sometimes the background images set via styles won't shown--I think, this is because image won't be there in the cache. > What you could try to debug your problem is a) include the CSS in the > requesting file rather than using a <link /> attribute or b) use gz > compression, to see if this improves loading. I'm still to work out your ideas. But, I guess I wouldn't want an internal CSS solution even that works. Thanks again. -- <?php echo 'Just another PHP saint'; ?> Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/ |
|
|||
|
"R. Rajesh Jeba Anbiah" <ng4rrjanbiah@rediffmail.com> wrote in message
news:1114346319.248725.153790@z14g2000cwz.googlegr oups.com... > This is quite OT. But, thought that many people here might have came > across such situation. > > I have used an external CSS file for a web page--at least for now > (before optimization) the size is quite big--50k. The page is now and > then behaves strange. That is, sometimes, only few styles are get > applied to the page. This happens often especially in FF; in IE also it > happens occasionally. Initially thought it's a parsing bug or so--but > validators don't throw any errors. Sometimes if we clear the cache, it > works--but not always this solution works. > > I have also approached the designer, she suspects the file size. > According to her, the styles in the bottom of the file is making > trouble often (but not all times). > > Does anyone came across similar situations? Is there any file size > limit in CSS? Couldn't find any thing similar in Google yet. TIA. > > -- > <?php echo 'Just another PHP saint'; ?> > Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/ > Have you try saving the page to your local disk? |
|
|||
|
R. Rajesh Jeba Anbiah wrote:
> > I have used an external CSS file for a web page--at least for now > (before optimization) the size is quite big--50k. The page is now and > then behaves strange. That is, sometimes, only few styles are get > applied to the page. This happens often especially in FF; in IE also it > happens occasionally. Initially thought it's a parsing bug or so--but > validators don't throw any errors. Sometimes if we clear the cache, it > works--but not always this solution works. Improvements following cache clearing suggest that the client does not receive the CSS file in its entirety. > Does anyone came across similar situations? ImageMagick.org sometimes behaves in a similar way. A page is rendered first, and the styles are applied after a very brief, yet noticeable, pause. It appears they generate CSS dynamically using a PHP script. > Is there any file size limit in CSS? File size might not be as important as the fact that your CSS file in external. It is possible you can solve your problem by including CSS server-side: echo "<style type='text/css'><!--\r\n"; readfile('style.css'); echo "--></style>\r\n"; This way, the client will receive the CSS before content and render content accordingly... Cheers, NC |
|
|||
|
NC wrote:
[snip] > echo "<style type='text/css'><!--\r\n"; Including SGML comment delimiters in both STYLE and SCRIPT elements is unnecessary, and undesired for XHTML documents (should you be authoring them). [snip] > This way, the client will receive the CSS before content and > render content accordingly... Though the benefits of cacheability are now negated. Mike -- Michael Winter Replace ".invalid" with ".uk" to reply by e-mail. |
|
|||
|
[Update]
Janwillem Borleffs wrote: > R. Rajesh Jeba Anbiah wrote: > > Does anyone came across similar situations? Is there any file size > > limit in CSS? Couldn't find any thing similar in Google yet. TIA. <snip> > What you could try to debug your problem is a) include the CSS in the > requesting file rather than using a <link /> attribute or b) use gz > compression, to see if this improves loading. (a) works, but I don't want this internal CSS, (b) doesn't work. According to my findings along with the designer, the file size has to be less than 32k or has to be in filesystem. I'm totally confused here:( -- <?php echo 'Just another PHP saint'; ?> Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/ |
|
|||
|
Chung Leong wrote:
> "R. Rajesh Jeba Anbiah" <ng4rrjanbiah@rediffmail.com> wrote in message > news:1114346319.248725.153790@z14g2000cwz.googlegr oups.com... <snip> > Have you try saving the page to your local disk? Yes, that works. Do you have any suggestion? Thanks for your input. -- <?php echo 'Just another PHP saint'; ?> Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/ |
|
|||
|
NC wrote:
> R. Rajesh Jeba Anbiah wrote: <snip> > >. Sometimes if we clear the cache, it > > works--but not always this solution works. > > Improvements following cache clearing suggest that the client > does not receive the CSS file in its entirety. Thanks for your reply. But, my header sniffing proves that the file is totally getting downloaded. I'm not sure, but it seems to be some buffer issue--our findings suggest that the CSS file cannot be greater than about 32k or else has to be in filesystem (this is really clueless--problem only on HTTP). Also, couldn't find any reason why the background images disapear in FF--again sounds like memory issue. > > Does anyone came across similar situations? > > ImageMagick.org sometimes behaves in a similar way. A page is > rendered first, and the styles are applied after a very brief, > yet noticeable, pause. It appears they generate CSS dynamically > using a PHP script. Yes, I have also noticed similar thing and that may happen only one page per site as it will be cached then. (FF has some bug in sending "If-Modified-Since" header for PHP pages, even if is forced.) But, for me, that seems to be ok than this weird behaviour of random styles get vanished. > > Is there any file size limit in CSS? > > File size might not be as important as the fact that your > CSS file in external. It is possible you can solve your > problem by including CSS server-side: > > echo "<style type='text/css'><!--\r\n"; > readfile('style.css'); > echo "--></style>\r\n"; > > This way, the client will receive the CSS before content and > render content accordingly... Unfortunately, I don't want to go for this internal CSS solution (though it works). I really want to make use of cacheability of CSS and like to avoid server load. Thanks for your comments. -- <?php echo 'Just another PHP saint'; ?> Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/ |
|
|||
|
Michael Winter wrote:
> NC wrote: <snip> > > This way, the client will receive the CSS before content and > > render content accordingly... > > Though the benefits of cacheability are now negated. Thanks for your comments. Yes, that's what I'm hesitating go for that. I've decided better to reduce the size. -- <?php echo 'Just another PHP saint'; ?> Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/ |