DivitoDesign

Everything for the Web Professional

Create Smaller CSS Files

Information about the Author:

Name:

URL: http://twitter.com/divitodesign

Description enjoy design, write articles, like typography, love football, keep chilling.

More on: CSS

25 Comments

  1. Cool summary discussing Create smaller CSS files. Always enjoy this blog.

  2. Thanks for the compliment.

  3. Wayne Pan says:

    You missed a few if you want to get extreme.
    The last statement of css does not require a semi colon (which means if the block only contains 1 rule, no semi-colons are needed:
    p{color:#00c;font-weight:bold}

    Also carriage returns are also not required, but at least required for readability :)

  4. This isn’t an extreme guide for cleaning up your CSS file. In my opinion, semi-colons are required to keep the styles readable and easy to edit.

    Thanks for sharing your view on this article. :)

  5. Navdeep says:

    a lot more tips exist but these r good.

  6. Acronyms says:

    “This can be written like this:
    Padding:10px 0;”

    should be

    This can be written like this:
    Padding:0 10px;

  7. ZanyPixel says:

    Nice tips! I will definitely be putting these to use.

  8. Acronyms; Thanks for noticing, changed the article.

  9. Mateusz says:

    Very interesting site. Hope it will always be alive!

  10. Thanx fuer die Infos. werde mal schauen, ob ich noch mehr darueber lesen kann. Falls es noch mehr Infos in deinem Blog gibt, dann waere es nett, wenn du mir die Infos geben koenntest. Oder Quellenangaben.

  11. [...] çœ‹äº†è¿™ç¯‡æ–‡ç« ï¼Œæƒ³æƒ³è‡ªå·±ä¹Ÿç»å¸¸å’Œ CSS 打交道,对于压缩 CSS [...]

  12. [...] It covers the basic aspect every website needs and absolutely nothing more, which is great for your optimized CSS files as well. * { border: 0; padding: 0; margin: 0; vertical-align: baseline; font-weight: inherit; [...]

  13. 3Mushrooms says:

    You Forgot White space/Carriage returns :)

    Also you can group similar properties of two or more elements that contain the same properties.

  14. White space, yes. I think you should not make your CSS file that hard to scan. You will not be able to find any CSS id’s or classes fast.

    The last point, I mentioned that. Look at my last point!

    Thanks for your comment. :-)

  15. [...] is a good idea to optimize your CSS files. As I told you before, there are a couple ways to improve your CSS coding. I have found an article studying the benefits and performance of CSS [...]

  16. ximx says:

    This is a small part of many CSS tips. But anyway, thanks)

  17. ildvr says:

    there are tons of advices to compress CSS, but this one is still the base for others

  18. This is a great example to follow!
    Very nice indeed.
    Thanks :)

  19. Your tip is wonderful! I like it a lot!
    Cheers ;)

  20. Excellent, faster page loads means more people that actually bothers to see your page, more people means more income. Good tips, not something i at least go around and think about. I’m glad someone do it for me :)

  21. Impressive work of guide, and details of step by step, great tips you given and thanks for sharing out your experience on the css.

    As I always wanted to try changing my web css file, but have less experience on it. Will try it out again with your guide.

    Thanks

  22. I agree it’s good practice to keep your css files as small as possible, though you need to balance this with readability for future editing.

    I’m interested to find out whether having multiple stylesheets eg separate stylesheet for menu and content results in greater loading times than a single stylesheet?

Please Respond and Give your Opinion

We use Gravatar to handle our avatars. Get one there!