You are here: Reference > CSS > at-rules > import

@import rule

Browser support:
Allows to import external style sheets.
The @import rule, similar to the link element, inserts an external style sheet into a document. The rules within the imported style sheet can be assigned to one or more specific media types.
In Javascript, the cssRules collection contains the CSS rules of a stylesheet, and the CSSImportRule object represents an @import rule. The cssRules collection is supported in Internet Explorer from version 9. In older versions, only the imported style sheet can be accessed by the imports collection.

Syntax:

@import "url" [media1, media2, ... mediaN];
@import url("url") [media1, media2, ... mediaN];
url - Required. Specifies the URL of the style file.
mediaN - Optional. Specifies the media type for all style rules listed in the imported style file.

Examples:

@import "style.css";
@import url("style.css");
    /* media-dependent @import rules:*/
@import "style.css" all, print;
@import url("style.css") print;
Did you find this example helpful? yes no

External links:

User Contributed Comments

Post Content

Post Content