best practices in css | tips and tricks css | top 16 tips in css | css must know tricks

We all write CSS but how often we write CSS which is easy to maintain. Below are the 15 things we need to take a close look at while writing CSS

1. Avoid using inline styles as they are hard to maintain and increase file size

           /*AVOID INLINE STYLES*/

2.Avoid using header styles as they are hard to maintain and increase file size

    body{font-size:14px} /*please avoid header or embedded styles*/

           /*AVOID INLINE STYLES*/

3. Avoid using @import within the HTML as this will slow down IE browsers

  @import "test.css"   /*please avoid @import*/

4.Avoid using multiple css files, or use a compressor to bundle all css files into one to increase page speed

5. Use multiple declartions where possible
6. use multiple selectors where possible
7. Use shorthand properties where possible
8. Avoid !important as its not necessary
9. Try complex selectors. Try to be only specific as needed
10. Avoid universal selectors due to performance issues


11. Avoid IE filters they slow page performance
12. Avoid ID’s for repeatable components. Use classes where ever possible
13. Try not to use many font-size declarations
14. Use a css minifer to reduce overall CSS file size
15. Use CSS sprites
16. Use CSS3 where ever possible to reduce images inturn http requests


I Am suresh(suresh kumar )a Web developer,Freelancer,webdesigner,UI developer from bangalore. Got 6+ yrs of IT experience . I specialize in standards-based XHTML, CSS and JavaScript web development. Each site I develop is built to be search engine friendly (SEO), using the latest development principles and techniques.

You may also like...

1 Response

  1. Michael says:

    Very nice list. Pitty we still have to code separately for IE though.

Leave a Reply

Your email address will not be published. Required fields are marked *