SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard triexa's Avatar
    Join Date
    Dec 2002
    Location
    Canada
    Posts
    2,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Performance: CSS

    I currently have one major css file which has the styles for MOST pages on the site

    However, Google's Page Speed:
    Minimize payload size

    If your site uses external CSS files shared among multiple pages, consider splitting them into smaller files containing rules for specific pages.
    But then you have this rule...
    Minimize round-trip times

    Combining external stylesheets into as few files as possible cuts down on RTTs and delays in downloading other resources.
    What to do? :S
    AskItOnline.com - Need answers? Ask it online.
    Create powerful online surveys with ease in minutes!
    Sign up for your FREE account today!
    Follow us on Twitter

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,379
    Mentioned
    180 Post(s)
    Tagged
    6 Thread(s)
    I think you are confusing what those recommendations are really saying as they are various suggestions for speed improvements based on certain criteria. If you minimise your file payload size so each file is under the packet boundary then the multiple files will load quicker. However if you combine them all into one file then they should run quicker still but may be harder to manage.

    If your site uses external CSS files shared among multiple pages, consider splitting them into smaller files containing rules for specific pages.
    That is basically saying to split the css into smaller css files for specific pages which means that you still only load a minimum css for that section and not the total css for the whole site. It doesn't mean split it into smaller css files and then include all those css files in the same page.

    The latter part just says that combining css files into one file is quicker rather than linking to half a dozen or so.

    So with both methods you would still combine the css files into one call for any page but on a large site you wouldn't combine all your css for all pages into one gigantic file as that would not make sense. You would usually have specific css for specific sections unless it's a small site.

    For example you may have a user login section and account pages and it would be silly to put the css into the main file for that as not all users will be registered to login and therefore the code is an overhead that will rarely be useful. You would just call that extra code in when needed but of course you would lose the cache effect had you included it all from the start.

    It's all swings and round-a-bouts and you have to choose what works best for the site in hand.


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
  •