Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

CSS resource loading and performance

CSS can reference additional stylesheets and fonts. Learn the distinction between fetching a resource and using it, and how to reduce network dependencies without promising a fixed rendering time.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

/* Resource loading is a concept, not a CSS property. */
@import url("theme.css");
@font-face {
  font-family: "SiteText";
  src: url("site-text.woff2") format("woff2");
  font-display: swap;
}

Resource loading and performance describes the relationship between resources used by CSS and page rendering; it is not a property name. The @import rule includes another stylesheet. Nested imports create dependencies: the browser must discover an import in its parent stylesheet's contents. Fetching a stylesheet and applying its rules are separate concerns.

An @font-face rule describes a font, and src identifies its source. Declaring a font alone does not mean it is downloaded immediately. The font-display: swap descriptor specifies an extremely short block period, then allows fallback text and a later swap to the intended font. It does not accelerate the transfer itself; swapping can change text layout.

The example removes dependencies on external stylesheets, images, and fonts: it contains its own styles and uses system-ui, sans-serif. It demonstrates the absence of those requests, not a guaranteed speed improvement. Before deployment, inspect requests and behavior in the target browser. CSSWG drafts describe semantics but do not prove support or performance in a particular implementation.

Examples

<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>CSS resource loading</title>
<style>
  body {
    font-family: system-ui, sans-serif;
    color: #172033;
    background-color: #ffffff;
  }
  .card {
    padding: 16px;
    border: 2px solid currentColor;
  }
</style>
<p class="card">Ready without external CSS resources.</p>
</html>

Result

Ready without external CSS resources.

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources