Site AI Auditمن Internet Solutions

CSS @import: Why It Delays Rendering and What to Use

4 نوفمبر 2026وقت القراءة: 8 دسرعة الموقع
CSS @import: Why It Delays Rendering and What to Use

Short answer: A CSS @import rule tells the browser to fetch another style sheet from inside a style sheet. The browser can only discover that file after it has downloaded and read the first one, so the requests happen one after another instead of side by side. Because style sheets block the first display of a page, this chain can delay everything. Replace @import with separate link tags, a combined file or self-hosted resources.

What @import does

CSS lets you include one style sheet inside another with a rule such as @import url(“other.css”). It is convenient, because it keeps related styles in separate files and allows one file to pull in the rest. Some themes use it to load a font from a font service. Some site builders and “additional CSS” boxes add it as well, and developers sometimes add it by habit.

The convenience has a cost that most people do not see. It affects how the browser plans its downloads, and the effect is largest on slow connections.

Why it is slow

A browser builds a page in stages. It reads the HTML and, as it reads, it starts to download the resources that it finds: style sheets, scripts and images. When the HTML contains several link tags for style sheets, the browser sees all of them at once and downloads them in parallel.

An @import rule hides inside a CSS file. The browser cannot know about it until the first file has arrived and been read. Only then does it start the second download. If the imported file has its own @import, a third one waits behind it. The result is a chain, as in this example:

  1. The HTML arrives and points to main.css.
  2. main.css arrives, and the browser sees an import of fonts.css.
  3. fonts.css arrives, and the browser sees a font file inside it.
  4. The font file is requested and arrives.

Every step in the chain adds a full round trip to the server. On a mobile connection with a delay of a few hundred milliseconds per request, three steps can add a second or more before the page can be shown. The pattern is easy to spot in the waterfall chart, where the requests form a staircase instead of a block.

Why style sheets block rendering

Browsers normally wait for the style sheets that are linked in the head before they paint the page. Showing content without its styles would cause a flash of unstyled text and a jump when the styles arrive. So style sheets are called render-blocking resources, a topic explained in the guide to eliminating render-blocking resources. An imported file is part of the blocking set. The page must wait for the whole chain.

This affects the metrics that users and search engines care about. A late start delays First Contentful Paint, described in the article on FCP, and it often delays the Largest Contentful Paint too, as covered in the guide to improving LCP.

Where @import appears on real sites

Search your style sheets and the style blocks in your page source for the text “@import”. If you use a preprocessor such as Sass, note that its own import is processed at build time and joins files before they reach the browser. That kind is harmless. The slow kind is the one that remains in the final CSS that visitors download.

What to use instead

Separate link tags

The simplest fix is to list each style sheet as its own link tag in the head. The browser discovers them together and downloads them in parallel. In WordPress, themes and plugins should add styles through the proper enqueue functions, which produce link tags.

One combined file

Combining files at build time reduces the number of requests. Many caching and optimisation plugins can join and minify style sheets, as explained in the article on minifying CSS and JavaScript. With HTTP/2 or HTTP/3 the number of requests matters less than it used to, but a chain of dependent requests is always worse than parallel ones.

Fonts through a link tag or self-hosting

If the import loads a font, use a link tag with a preconnect hint, or host the font on your own domain. The trade-offs are discussed in the guide to self-hosting Google Fonts and in the article about web font performance. Resource hints are explained in preload, preconnect and prefetch.

Inline critical styles

For advanced optimisation, the styles needed for the first screen can be placed directly in the HTML, and the rest loaded later. See the article on critical CSS. This is worth doing only after the simple fixes.

How to fix it step by step

  1. Find every import. Search your theme, plugin and custom CSS for @import, and note the files they pull in.
  2. Decide how to replace each one. Link tag, combined file or self-hosted font.
  3. Make the change on a staging copy. Layout can change if the order of styles changes, because later rules override earlier ones. Keep the same order.
  4. Clear caches. Purge page, CDN and optimisation plugin caches so that visitors receive the new files.
  5. Compare the waterfall. The staircase should become a flat block, and the first paint should move earlier.
  6. Test on a phone. Confirm that the page looks the same and loads faster on a throttled connection.

How much time can you save?

The gain depends on how long the chain is and how slow the connection is. A site with one import of a small file on a fast office network may see no difference at all. A site with a chain of three imports, tested on a mid-range phone with a mobile connection, can see the first paint move earlier by a second or more. The only honest way to know is to measure your own pages.

  1. Record a baseline with a throttled mobile profile in your testing tool, and note First Contentful Paint and Largest Contentful Paint.
  2. Apply the change.
  3. Run the same test at least three times, and compare the median values, because single runs vary.

Be careful not to expect miracles. Replacing an import is one improvement among many, and large images, slow servers and heavy scripts often cost more. Its value is that it is cheap, safe when done carefully and permanent. Once the chain is gone, it will not return unless someone adds a new import, so mention the rule in your development notes and ask agencies and plugin authors to follow it.

If you cannot change the code, for example because it belongs to a theme that you do not control, ask the theme author for a fix, or switch to a theme that loads its styles properly. A slower first paint that you cannot influence is a fair reason to reconsider the theme itself.

Common mistakes

How Site AI Audit helps

Site AI Audit does not scan style sheets for @import rules. It measures the result visitors feel: the Google PageSpeed score, loading metrics such as LCP, CLS and INP, server response time, compression and page weight, together with checks for SEO, security and e-mail. Use it before and after a change to confirm that pages became faster. The first check is free, covers up to 50 pages and needs no sign-up. You can run a free check of your website or see the plans for weekly monitoring and alerts.

Related reading

The bottom line

CSS @import hides files from the browser until it is too late. Replace it with link tags, a combined file or self-hosted fonts, keep the order of styles and check the waterfall afterwards. It is a small change that often makes the first screen appear sooner.

الأسئلة الشائعة

Is @import always bad?

In the final CSS that browsers download, it usually creates avoidable delay. Build-time imports in a preprocessor are fine, because they are combined before delivery.

How can I tell if my site uses it?

Search style sheets and page source for “@import”, or look for a staircase of CSS requests in the network waterfall.

Does HTTP/2 fix the problem?

No. It helps parallel downloads, but the browser still finds imported files late, so the chain remains.

Can I import Google Fonts with @import?

It works, but a link tag with a preconnect hint, or self-hosted fonts, is faster and more predictable.

Will fixing it change how my site looks?

It should not, as long as the order of the styles stays the same. Test the main pages after the change.

#Core Web Vitals#Page speed#WordPress performance
افحص موقعك — مجانًا.ما الذي يجب إصلاحه في موقعك — ومن أين تبدأ.
ابدأ مجانًا

المزيد من المدونة

كل المقالات ←
Internet Solutions

المزيد من فريقنا

من تطوير Internet Solutions. جرّب بقية منتجاتنا — كل منها يوفّر وقتك بطريقة مختلفة.

internet-solutions.net ↗
01النشر التلقائي على وسائل التواصل
PostRSS

تنتقل المنشورات الجديدة من خلاصة RSS الخاصة بك تلقائيًا إلى Facebook وX وLinkedIn وTelegram وأكثر من 60 شبكة أخرى.

خطة مجانية · منذ 2014زيارة ←
02دردشة مباشرة بالذكاء الاصطناعي للمواقع
Talkmio

يجيب موقعك على الزوار على مدار الساعة من محتواك أنت وبلغتهم.

خطة مجانية · دون بطاقةزيارة ←
03مساعد بالذكاء الاصطناعي
Ask Mio

دردشة وبرمجة وتصميم وكتابة وبحث. يختار Mio أفضل نموذج لكل مهمة.

خطة مجانيةزيارة ←
04طيار آلي بالذكاء الاصطناعي للمدونة ووسائل التواصل
AI Blog Autopilot

يكتب الذكاء الاصطناعي مقالات SEO من 2000 إلى 3000 كلمة وينشر كل مقال على أكثر من 60 شبكة اجتماعية.

أول 3 مقالات مجانًازيارة ←
05زحف SEO متعمّق
Site SEO AI Audit

زحف SEO كامل عبر 7 مجالات، بما فيها الظهور في البحث بالذكاء الاصطناعي، مع إصلاحات مرتّبة حسب التأثير.

أول تدقيق مجانيزيارة ←
06خلاصات RSS والمنتجات
RSS Feed Creator

أنشئ RSS من أي صفحة ويب، بالإضافة إلى خلاصات منتجات لـ Google وMeta تتحدّث تلقائيًا.

خطة مجانيةزيارة ←
07تطوير المواقع وتحسين محركات البحث
Internet Solutions

مواقع ومتاجر إلكترونية وأنظمة مخصّصة، يصمّمها فريقنا ويبنيها ويديرها.

منذ 2011زيارة ←