Home  >  Q&A  >  body text

Is using an external CSS file really more efficient than using style tags?

I heard that external css files can be cached by the browser, thus improving network performance.

My question is is this true?

Do cached CSS files really improve performance?

P粉864594965P粉864594965258 days ago284

reply all(1)I'll reply

  • P粉055726146

    P粉0557261462024-02-04 00:08:24

    In fact, browsers will try to cache CSS stylesheets (within limits) so that they are only fetched once and served on demand. This saves network bandwidth.

    It can be assumed that CSS will not change much relative to the content of the website. Therefore, depending on the implementation, it is often ideal to separate style definition from content, especially if the design is for reusability.

    reply
    0
  • Cancelreply