How to make css less?

I have a CSS file that stylizes the whole page and it gets Gzip and its miniature, but it is still 200kb. Is there anything else I can do?

0
source share
1 answer

I looked at your profile and found www.charliecarver.me, looked at it and found the css file. If this is your site and the css file you are talking about, you are repeating many statements. For example, line 1 through 13 of your css file looks like this:

body { /** css code... **/ } 

Line 15 through 17 is as follows:

 body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,input,textarea,p,blockquote,th,td { /** css code... **/ } 

Line 432 through 434:

 html>body #content { /** css code... **/ } 

Line 826 - 828:

 body,td,th,.metadata a:link,.metadata a:visited,.navigation a:link,.navigation { /** css code... **/ } 

All that can be done with a single block of code that references the body. So, reduce the number of repetitions you have. Just to give you an idea of ​​what is repeated:

Items:

  • "div" appears 35 times
  • "dt" appears 50 times
  • "dd" appears 30 times
  • "ol" appears 49 times
  • "li" appears 6 times
  • "yui" appears 315 times

In addition, using only what you need will significantly reduce the size.

+8
source

All Articles