For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > April 2005 > Re: CSS file size limit









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: CSS file size limit
NC

2005-04-25, 3:56 pm

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

Michael Winter

2005-04-25, 8:55 pm

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







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com