The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

@import rule

Imports an external style sheet.

CSS 2.1, Section 6.3






Standards information


The rule has no default value.

The semicolon in the syntax is required; if omitted, the style sheet is not imported properly and an error message is generated. "url()" is optional because there is always a URL following "@import".

The @import rule, like the link element, links an external style sheet to a document. This helps the Web author establish a consistent "look" across multiple HTML pages. Whereas the link element specifies the name of the style sheet to import using its href attribute, the @import rule specifies the style sheet definition inside a link element or a style element. In the scripting model, this means the owningElement property of the style sheet defined through the @import rule is either a style or a link object.

The @import rule should occur at the start of a style sheet, before any declarations. You can place @import rule statements anywhere within the style sheet definition, but the rules contained within the @import rule style sheet are applied to the document before any other rules defined for the containing style sheet. This rule order affects expected rendering.

Rules in the style sheet override rules in the imported style sheet.

You can also specify media-dependant @import rules. After the URI, specify a comma-separated media type.


The following example uses the @import rule to import a style sheet. Replace "styles.css" in the example with the location of a working style sheet.

<style type="text/css">
@import url("styles.css");
p {
  color: blue;

You can also specify a style sheet without using "url()", as follows:

<style type="text/css">
@import "styles.css";
P {
  color: blue;

See also