What is better 1 css file or few css files?

Discussion in 'CSS' started by MyLibary, Feb 26, 2011.

  1. #1
    Hey guys..

    Right now i have on my site around 6 css files, my programmer said its better and faster.

    Is that right? is that better if there is multiplate css files?

    Thanks alot,
    Marco.
     
    MyLibary, Feb 26, 2011 IP
  2. Bapinder

    Bapinder Well-Known Member

    Messages:
    151
    Likes Received:
    7
    Best Answers:
    3
    Trophy Points:
    120
    #2
    It's up to you. I prefer using 1 css file, but using more than 1 is fine, especially if your site is big. Using more than 1 css file actually makes editing easier. Like having a css file for the header, one for content and one for the footer. It doesn't change much though.
     
    Bapinder, Feb 26, 2011 IP
  3. buzenko

    buzenko Peon

    Messages:
    93
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    buzenko, Feb 26, 2011 IP
  4. MyLibary

    MyLibary Well-Known Member

    Messages:
    693
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #4
    MyLibary, Feb 26, 2011 IP
  5. marharri

    marharri Peon

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You have ctrl+F... put it all in one css file. The only time I ever make more than one css file is for "printer-friendly" versions of the same site where i want to add "display:none" or change the background to white. In that case, the page still only calls one .css file, just a different one.
     
    marharri, Feb 26, 2011 IP
  6. AtSeaDesign

    AtSeaDesign Active Member

    Messages:
    172
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    93
    #6
    there is another trick you could use as well. I load separate style sheets on my portfolio page for instance using lazyloading with javascript. That way no unused code is loaded on the page where it is not needed.

    And as mentioned ALWAYS compress your code. Either via htaccess or a compressor. I put all my stuff through minify. Great tool.
     
    AtSeaDesign, Feb 27, 2011 IP