Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS

Dennis de Vries
Dennis de Vries
9,440 Points

CSS reset and site performance

After watching Guil's video about adding and editing normalize.css as a css reset, I was left wondering: what is the impact on site performance?

To specifiy, in my mind loading multiple stylesheets means extra work for the browser encoding all that stuff. The browser goes through normalize first, then through the actual stylesheet. Sounds like double the work. It might be minor, and hardly noticable, but does it work like that? Does using multiple stylesheets take more time?

Also, I was wondering about editing normalize.css. Guil said something along the lines of removing rules you don't need. As I understood this is optional, but from a performance point of view: should you? It kind of makes sense to me, to keep the stylesheets as lean as possible so no rules are read or loaded when they shouldn't be.

Does it work like this?

Thanks!

3 Answers

Ferdinand Pretorius
Ferdinand Pretorius
18,705 Points

Hi Dennis,

The impact it has on your site performance is nearly unnoticeable. This is because css gets cached. Different browsers have slightly different behaviour, but I haven't had many developers question this.

For optimization, yes you can edit the normalize.css file, after all it is just a normal css file and follow all the same rules, just be sure you know what you are doing when you modify it. You can also choose to minify it, or you can just download the minified version. Also you should be able to find a cdn that has a nomalize.min.css file.

Personally I have never edited the nomalize file. I use a cdn for smaller sites, and use my own minified version for bigger apps.

Hope this clear things up for you.

Just a little extra information..

If you have Google Chrome installed. You can use the network window inside the Developer Tools. This is a great feature that will allow you to see the load time for any css reset files you load into your page.

Ferdinand Pretorius
Ferdinand Pretorius
18,705 Points

This is true, just remember to disable cache (very obvious checkbox) before you refresh.

Thanks Don. 1 up!

Dennis de Vries
Dennis de Vries
9,440 Points

Ah, yes. Kind of forgot about that, from an earlier treehouse course. Thanks for the advice!

Btw, thanks for asking this question. I never really thought of asking, but it was pretty insightful!