Forum Moderators: not2easy

Message Too Old, No Replies

Opinions needed - how many style sheets is too many?

         

BKahuna

4:14 am on Apr 2, 2008 (gmt 0)

10+ Year Member



I'm setting up a site that has two template pages in the form of master pages. Some of the content pages are fairly complicated and there are quite a few of them.

For ease of maintenance, I'd like to have a separate style sheet for each content page. This way I don't have to wade through a thousand elements to find the one I'm looking for. Each style sheet will only contain the elements that are unique to that content page.

I am not allowed to link a style sheet to the content page. The style sheet must be linked to the master page. As such, the master page has one style sheet for each content page as well as a couple general purpose style sheets linked to it. Currently, that only numbers around a half dozen but it will at least double before I'm done.

Is there a performance hit to having so many style sheets linked to one page? Is this a bad way of organizing my style sheets? Is there a better way?

Thanks for your opinions,

BK

[edited by: BKahuna at 4:15 am (utc) on April 2, 2008]

Setek

5:19 am on Apr 2, 2008 (gmt 0)

10+ Year Member



The more separate stylesheets you have, the more HTTP header requests.

Less is better: 1 x 10KB stylesheet is more efficient than 10 x 1KB stylesheets.

Well, you could always organise one (or a few) stylesheet(s) with comments everywhere, but it can still get confusing.

Dunno about a better way, there's just different ways that different people use.

Xapti

6:53 am on Apr 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Depending on the size of your css (if it gets above 2-10% of your total page size), then you may want to modularize it, so that only required style info is downloaded. I think 4 pieces would be ample enough for modularization, but I guess you coullalways deviate a bit.

BKahuna

4:13 pm on Apr 2, 2008 (gmt 0)

10+ Year Member



It sounds like a compromise is the best solution. With the overhead of loading each style sheet (regardless of size) it seems prudent to minimize the number of style sheets loaded.

However, the clutter of styling 200 elements in a single sheet makes it too daunting to try to maintain (or build) the site. I guess I can find a way to group my pages in some logical fashion so that I can have a single style sheet for each group. Each style sheet would contain the layout for all the pages in that group.

Thanks very much for the input.

BK