Re: formatting - design question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrew Ballard wrote:
> On Thu, Jun 4, 2009 at 12:54 PM, PJ <af.gourmet@xxxxxxxxxxxx> wrote:
>> This may not be strictly php but I think is may be relevant.
>> Were I to use a different css file for every page (that is slightly
>> different), would that affect performance?
>> It seems to me that might be a way of simplifying and certainly speeding
>> up development (design-wise, anyway) when using css. A different css
>> file for different pages would certainly make it a breeze to design a
>> page; otherwise it is hell to try to put all formatting in one file - it
>> even tends to get fairly bloated and difficult to follow your own shadow.
>>
>> --
>> Hervé Kempf: "Pour sauver la plančte, sortez du capitalisme."
>> -------------------------------------------------------------
>> Phil Jourdan --- pj@xxxxxxxxxxxxx
>>   http://www.ptahhotep.com
>>   http://www.chiccantine.com/andypantry.php
>>
>>
> 
> It might be simpler during development, but YSlow! recommends putting
> them in as few pages as is practical so the browser has fewer
> resources to fetch and can make better use of caching. It won't affect
> the speed of your PHP pages, but it should speed up the overall
> download time of your pages from the end-user's perspective.
> 
> Andrew

I would have one main file that holds common styles and then if you need
one, a page specific style sheet. You can even add all styles to the
first and then override them in the second.  This is how they were
intended to be used.  Also, most times the style sheets will be cached
by the browser so only the first page load should matter.

/* style sheet 1 */
.someclass { color: red; }
/* style sheet 2 */
.someclass { color: blue }

someclass will be blue.

/* style sheet 1 */
.someclass { color: red; }
/* style sheet 2 */
.someclass { color: blue; background-color: yellow; }

/* style sheet 1 */
.someclass { color: red; }
/* style sheet 3 */
.someclass { color: blue; background-color: white; }

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux