Big CSS Filesize

Discussion in 'HTML & Website Design' started by w3goodies, Jan 6, 2010.

  1. #1
    Hello,
    I am working on script, and was constantly adding css codes. Just now, I saw I had reached 12kb :D ... Is this any problem? Do I need to make it smaller?
     
    w3goodies, Jan 6, 2010 IP
  2. harrierdh

    harrierdh Peon

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    That's actually smaller than most images. If you are constantly adding styles you are not taking advantage of css cascading ability.
     
    harrierdh, Jan 6, 2010 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #3
    I don't get nervous on CSS until I break the 30k mark. I'd be much more concerned about the size of the markup. CSS that's common to all your pages only needs to be loaded on the first time someone visits a page - so it's a lot less of an impact than HTML that is sent with every page...

    Which is why developers have been moving to the separation of presentation from content method of site building.

    Out of curiosity, what's your code to content ratio on the markup?
     
    deathshadow, Jan 6, 2010 IP
  4. w3goodies

    w3goodies Member

    Messages:
    94
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #4
    My homepage file size is 5kb while CSS is 12 kb. Is it worst?
     
    w3goodies, Jan 7, 2010 IP
  5. desiznfreak

    desiznfreak Member

    Messages:
    73
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #5
    no... but u can compress your CSS using CSS compression tools
     
    desiznfreak, Jan 7, 2010 IP
  6. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #6
    Well, how big is your content? I probably should have clarified on that, I meant the size of your text without the tags (ctrl-C from the page in browser, paste into a editor to find out how big it is without tags)... but really 5k of markup is nothing to worry about...

    Either way - I'd not be worrying about 17k in two files. Don't start worrying until you've got 100k+ of HTML and 40k of CSS for 5K of actual text content on the page.

    I see that half-assed **** all the time. Compared to most, you've still got nothing - and that's not necessarily a bad thing.
     
    deathshadow, Jan 7, 2010 IP
  7. Lex350

    Lex350 Notable Member

    Messages:
    1,889
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    215
    #7
    My css file was over 14k and I used firefox to minify it. You should do the same to save some file space and loading time.
     
    Lex350, Jan 7, 2010 IP
  8. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #8
    Or you could leave all your white-space in place so it's easier to maintain, and turn on server compression.

    Not that the 1k or less whitespace stripping would provide in savings on 14k or more CSS is enough to worry about on websites with 150k of images, images for text content, and 19k of markup for 3k of actual text on the page - AND broken layouts. (I'm assuming you mean the sites in your links)
     
    deathshadow, Jan 8, 2010 IP
  9. YMC

    YMC Well-Known Member

    Messages:
    2,787
    Likes Received:
    404
    Best Answers:
    4
    Trophy Points:
    190
    #9
    Perhaps run it through the W3C validator? It picks up a lot of redundant code i.e. Style 1 and Style 2 are the same sort of thing.
     
    YMC, Jan 11, 2010 IP
  10. -webmaster

    -webmaster Peon

    Messages:
    327
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Reducing css size will increase website loading speed for sure, though 12kb is nothing and I wouldn't worry that much. :)
     
    -webmaster, Jan 12, 2010 IP