Results 1 to 7 of 7

Thread: One main style sheet or many?

  1. #1
    Join Date
    Jul 2007
    Location
    California
    Posts
    177
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default One main style sheet or many?

    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/...ial/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!

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    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/s...ad.php?t=21617
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jul 2007
    Location
    California
    Posts
    177
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    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,

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    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.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,986
    Thanks
    43
    Thanked 3,198 Times in 3,160 Posts
    Blog Entries
    12

    Default

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

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Jul 2007
    Location
    California
    Posts
    177
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Cool that makes sense... now I'm just hoping someone found a fix to my menu issue I posted

    Thanks everyone!

  7. #7
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Sliight View Post
    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...
    Mike

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •