Log in

View Full Version : One main style sheet or many?



Sliight
07-14-2007, 09:14 AM
I just read the tutorial and started using the program Stye Master. I'd absolutely recommend this to anyone who's new... I learned a TON from it. Here's the tutorial link, and you can download the demo there (I'm going to buy it). http://www.westciv.com/style_master/academy/hands_on_tutorial/index.html So far it's the only tutorial which actually teaches you how to do something, instead of just guiding you.

So here's my question: I plan on having around 25-40 pages on my website. I definitely want to use one main style sheet for general arrangement to keep all the pages looking uniform. However I'd like to know if I should use this one style sheet for every piece of content on every page, or if people tend to use multiple style sheets? I figure I can just name all the ID's using a number for each page. <p1> <p2> etc...

Any thoughts would be appreciated! Thank you!

djr33
07-14-2007, 09:57 AM
You can have more than one stylesheet on a page.
You could have a main sheet for all pages.
You could have individual sheets for some/individual pages.
And you could include some specific CSS elements in the head section for each page.

It's all up to you.

Using a single stylesheet allows for easy editing (and less transfer to the user in many cases), so that's the best idea. But if you need it to be varied for individual pages, that obviously won't work. Use a combination of the other ideas above.


Additionally, and this would only make sense in some cases, you could use the method described here, for dynamic style sheets:
http://www.dynamicdrive.com/forums/showthread.php?t=21617

Sliight
07-14-2007, 05:51 PM
Would it cause a slowdown issue (mainly for those still on dial up, yes they exist I still work on computer issues for people who have it... some even on aol dial up! ewww...) ... Would it cause a slowdown issue to have every page load all of my stylesheets?

Basically I want to create the general map of my website. I'm going to create 50 pages that all have the same code, and reference the same style sheets. I'll create one main style sheet, and about 15 blank style sheets to start. This way when it comes time to mess with the content I just need to use unique ID's in the page I wanna mess with.

Does this seem a logical approach?

Thanks,

Twey
07-14-2007, 10:30 PM
It would be more efficient to load a single global stylesheet, yes. However, that's only if the content is actually used. Ideally, if your pages are all themed and consistent, the style defined in that one main stylesheet should be all that's necessary to style the majority of your pages. It's a good idea to put exceptions in a separate stylesheet.

In addition to that, it's likely you'll find that you need a separate stylesheet dedicated to fixing IE's bugs. Since this will be quite small, I'd advise putting even the exceptions into the same file.

jscheuer1
07-15-2007, 02:14 PM
All good advice. I'd like to add that if you load a stylesheet on one page, it will not need to be loaded again for other pages. So, to answer the question about dial-up, the ideal situation would be to have as simple (short) of a stylesheet as possible, and link it to all pages.

Sliight
07-15-2007, 05:26 PM
Cool that makes sense... now I'm just hoping someone found a fix to my menu issue I posted :)

Thanks everyone!

mwinter
07-16-2007, 05:10 PM
Would it cause a slowdown issue to have every page load all of my stylesheets?

No, not if they are cached: they'll be downloaded once and only checked for updates in future. There's still some overhead, but not nearly as much. Barring weird server settings, or use of a server-side language to dynamically generate the style sheets, this should be automatic - the latter cause can be mitigated with a little effort.



Does this seem a logical approach?

The really important thing is that you use a system that's easy for you to maintain. If it helps you to manage the site and remember where everything is, I'd say do it in most cases.

I can never understand why some people create files named page1.html, etc... :confused: