Search code examples
cssstylesload-time

Do unused CSS styles affect load times


I am wondering if unused CSS styles affect load times because I normally break my sections of my code using this format

/*===================
      Nav-Styles
===================*/

However, I also use coda to write my code. It has a code navigator, which detects ids followed by {}

what I thought might help with my code organisation is to create this format of break

/*==========================================
  #----NAV-STYLES-BEGIN {} /* Nav Styles */ 
==========================================*/ 

This will mean my section breaks will them appear in the code navigator and can be jumped to quickly. However, if this is going to cause speed related issues, the means will outweigh the end.

Is this a bad idea or will the difference be so insignificant that it's worth doing if I wanted?


Solution

  • Any unused CSS or JS that is passed over the wire to the client will hurt the sites performance at the least to a small degree. The unused CSS increases the size of the page, therefore increasing the time it takes to download a page. A few characters here and there will not have a huge impact on your download times, however if there is a large amount of unused styling there may be an impact. This is why many people compress their CSS and JS.