[OT] CSS file size limit

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-24-2005
R. Rajesh Jeba Anbiah
 
Posts: n/a
Default [OT] CSS file size limit

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/

Reply With Quote
  #2 (permalink)  
Old 04-24-2005
Janwillem Borleffs
 
Posts: n/a
Default Re: [OT] CSS file size limit

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



Reply With Quote
  #3 (permalink)  
Old 04-24-2005
R. Rajesh Jeba Anbiah
 
Posts: n/a
Default Re: [OT] CSS file size limit

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/

Reply With Quote
  #4 (permalink)  
Old 04-25-2005
Chung Leong
 
Posts: n/a
Default Re: [OT] CSS file size limit

"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?


Reply With Quote
  #5 (permalink)  
Old 04-25-2005
NC
 
Posts: n/a
Default Re: CSS file size limit

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

Reply With Quote
  #6 (permalink)  
Old 04-25-2005
Michael Winter
 
Posts: n/a
Default Re: CSS file size limit

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.
Reply With Quote
  #7 (permalink)  
Old 04-26-2005
R. Rajesh Jeba Anbiah
 
Posts: n/a
Default Re: [OT] CSS file size limit

[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/

Reply With Quote
  #8 (permalink)  
Old 04-26-2005
R. Rajesh Jeba Anbiah
 
Posts: n/a
Default Re: [OT] CSS file size limit

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/

Reply With Quote
  #9 (permalink)  
Old 04-26-2005
R. Rajesh Jeba Anbiah
 
Posts: n/a
Default Re: [OT] CSS file size limit

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/

Reply With Quote
  #10 (permalink)  
Old 04-26-2005
R. Rajesh Jeba Anbiah
 
Posts: n/a
Default Re: [OT] CSS file size limit

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/

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 11:02 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0