The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. On-Page / Site Optimization
    4. Is it better to put all your CSS in 1 file or is it no problem to use 10 files or more like on most frameworks?

    Is it better to put all your CSS in 1 file or is it no problem to use 10 files or more like on most frameworks?

    On-Page / Site Optimization
    8 4 136
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • conversal
      conversal last edited by

      Is it better to put all your CSS in 1 file or is it no problem to use 10 files or more like on most frameworks?

      1 Reply Last reply Reply Quote 0
      • crackingmedia
        crackingmedia last edited by

        It really depends on how big your site is and how complex your CSS. On a small site or if it has minimal CSS one is perfectly adequate. On a larger site with lots of pages and CSS it makes sense to break down the the CSS around their function.Peter

        1 Reply Last reply Reply Quote 2
        • conversal
          conversal last edited by

          Thanks for your answer!

          It makes sense, because on large sites you will need different styling on different type of pages? So when you would put it all in 1 file, al this CSS would be loaded on ALL pages, while it's only needed on some particular?

          Or what's the advantage here?

          crackingmedia 1 Reply Last reply Reply Quote 0
          • brad.s.knutson
            brad.s.knutson last edited by

            For a production environment, I would suggest having one minified CSS file.  This will reduce file size (minifying) and server requests (1 file as opposed to 10).  This will help reduce page load time.

            Of course, on your staging environment, or in an archive of the website, it would be best to have your stylesheets broken down into an easier to manage system.  That might mean multiple CSS files, it might not - it's up to you to manage.

            1 Reply Last reply Reply Quote 0
            • crackingmedia
              crackingmedia @conversal last edited by

              You could split them up based on where they are needed but that would become complicated. The advantage of splitting CSS on a large site is really to better organise the functionality of the CSS, e.g. system.css.

              Peter

              1 Reply Last reply Reply Quote 1
              • conversal
                conversal last edited by

                That's what I was thinking too.. Currently, most of my frameworks have 10 CSS files, which means you have 10 server requests. Page speed as in my eyes a very important factor, therefore this question...

                1 Reply Last reply Reply Quote 0
                • webmethod
                  webmethod last edited by

                  Hi,

                  From a code management point of view - as Peter says it's very common practice to split your CSS into different files as they are then much easier to manage and maintain. You can use a tool like Yahoo's YUI compressor to minify - as Bradley says - and aggregate (merge) these files.

                  From a web performance point of view, less files does not always mean better performance. Web browsers used to only download up to 2 files per domain, but now it's pretty standard for them to support 6 or more. See a browser breakdown for Max Connections and Connections per hostname here: http://www.browserscope.org/?category=network&v=top. I wouldn't recommend trying to split across 6 files, but you might find that if you have one massive CSS file it will download quicker when split up.

                  There is another disadvantage to having a single, CSS file in that you're not making the most of web browser caching. Every time you change any CSS, all users will have to download the entire file again. Again this may not be a problem for you, but something to bear in mind.

                  My advice would be to point Google Pagespeed at your website's key pages and act on as much as the feedback as possible: https://developers.google.com/speed/pagespeed/. It is a fantastic resource and presents its findings very clearly.

                  George
                  @methodicalweb

                  1 Reply Last reply Reply Quote 1
                  • conversal
                    conversal last edited by

                    Thanks a lot for this usefull info, it helped me understand this better.

                    1 Reply Last reply Reply Quote 0
                    • 1 / 1
                    • First post
                      Last post
                    • Can we use "top 10" in title?
                      SurgeStream
                      SurgeStream
                      0
                      5
                      93

                    • Duplicate Content when Using "visibility classes" in responsive design layouts? - a SEO-Problem?
                      inlinear
                      inlinear
                      0
                      5
                      3.6k

                    • Using phrases like 'NO 1' or 'Best' int he title tag
                      Webrevolve
                      Webrevolve
                      0
                      6
                      133

                    • High Volume Duplicate Title and Content Errors: Scale of 1-10 How bad is this?
                      aruegger
                      aruegger
                      0
                      3
                      286

                    • What font should i use for my text to make page better
                      ClaireH-184886
                      ClaireH-184886
                      0
                      3
                      383

                    • The Better Title to Use?
                      RyanKent
                      RyanKent
                      0
                      7
                      904

                    • Why isn't SEOMoz using File Extensions (*.html etc) on any of their web page URLs?
                      G-Force
                      G-Force
                      0
                      4
                      1.2k

                    • Has anyone noticed a big delta between Google and Bing rankings? For example, we rank favorably in Google, but not so favorably in Bing. Are there different tactics I should use to rank better in Bing?
                      Andy.Drinkwater
                      Andy.Drinkwater
                      0
                      2
                      949

                    Get started with Moz Pro!

                    Unlock the power of advanced SEO tools and data-driven insights.

                    Start my free trial
                    Products
                    • Moz Pro
                    • Moz Local
                    • Moz API
                    • Moz Data
                    • STAT
                    • Product Updates
                    Moz Solutions
                    • SMB Solutions
                    • Agency Solutions
                    • Enterprise Solutions
                    • Digital Marketers
                    Free SEO Tools
                    • Domain Authority Checker
                    • Link Explorer
                    • Keyword Explorer
                    • Competitive Research
                    • Brand Authority Checker
                    • Local Citation Checker
                    • MozBar Extension
                    • MozCast
                    Resources
                    • Blog
                    • SEO Learning Center
                    • Help Hub
                    • Beginner's Guide to SEO
                    • How-to Guides
                    • Moz Academy
                    • API Docs
                    About Moz
                    • About
                    • Team
                    • Careers
                    • Contact
                    Why Moz
                    • Case Studies
                    • Testimonials
                    Get Involved
                    • Become an Affiliate
                    • MozCon
                    • Webinars
                    • Practical Marketer Series
                    • MozPod
                    Connect with us

                    Contact the Help team

                    Join our newsletter
                    Moz logo
                    © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
                    • Accessibility
                    • Terms of Use
                    • Privacy