Grow your CSS skills. Land your dream job.

Does Linking an External Stylesheet Slow Down Website Load Time?

  • # April 18, 2013 at 7:39 pm

    I want to know if linking external files like stylesheets/js/plug-ins slow down the loading speed of your website? would it load faster if the styles and javascript were in the same html page that is being loaded? or would it not effect loading speed at all?

    # April 18, 2013 at 8:53 pm

    Technically yes, but then on the next page load, that stylesheet / js file / image, whatever external resource is cached. So It doesn’t have to come across the internet again, it just comes right from your local machine. If you embed everything into every page, everything has to be re-downloaded each time. Of course it’s more complicated than this, but that’s a foundation to start going to down the rabbit hole or whatever.

    # April 18, 2013 at 8:56 pm

    Using external style sheet has many advantages over inline or embedded styles which I won’t rehash here. There’s plenty of info on the web about that. As far as speed difference between pages with linked style sheet and or pages with inline or embedded styles is probably so minuscule that it’s going to be hardly noticeable if at all and only during the the viewing of the first page.

    Since client cache stores style sheet upon a visit to first page, viewing of subsequent pages will be quicker and smoother. At this point, the speed is only affected by the latency of browser itself.

    # April 18, 2013 at 9:15 pm

    That defiantly answered my question. Thanks, ill stick to external files instead of jamming everything on a single document.

    # April 19, 2013 at 6:51 am

    Yesterday they released jQuery 2.0, and on their blog they linked to an interesting [article](

    That article is about jQuery but the information about caching applies to your case as well. The most interesting part is this:

    > When you’re dealing with large assets, a 304 response can save significant amounts of download time. Unfortunately, with a file as small as jQuery, the ceremony necessary to retrieve that 304 response is nearly as time consuming as just downloading the file in the first place.

    jQuery is a pretty large file compared to your CSS file (probably), so I think this is what Chris means by it’s more complicated than that. The solution is far future caching, which eliminates the 304 ‘handshake’. The only downside is that you need to rename the file on every update you make, otherwise users who have the cached version won’t see the update. (some people suggest added a query to the CSS url like `global.css?v=1.2`, but it turns out proxies won’t cache that, so `global.v1.2.css` would be better)

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".