CSS @-kurallarıdan olan @import diğer stil dosyalarından stil kurallarını mevcut sayfamıza dahil etmek için kullanılır. These rules must precede all other types of rules, except @charset (en-US) rules; as it is not a nested statement, @import cannot be used inside conditional group at-rules.

@import url("fineprint.css") print;
@import url("bluish.css") projection, tv;
@import 'custom.css';
@import url("chrome://communicator/skin/");
@import "common.css" screen, projection;
@import url('landscape.css') screen and (orientation:landscape);

So that user agents can avoid retrieving resources for unsupported media types, authors may specify media-dependent @import rules. These conditional imports specify comma-separated media queries after the URL. In the absence of any media query, the import is unconditional. Specifying all for the medium has the same effect.


@import url;
@import url list-of-media-queries;


Is a <string> (en-US) or a <url> (en-US) representing the location of the resource to import. The URL may be absolute or relative. Note that the URL need not actually specify a file; it can just specify the package name and part, and the appropriate file is chosen automatically (e.g. chrome://communicator/skin/). See here for more information.
Is a comma-separated list of media queries conditioning the application of the CSS rules defined in the linked URL. If the browser does not support any these queries, it does not load the linked resource.

Formal syntax

@import [ (en-US) <string> (en-US) | (en-US) <url> (en-US) ] (en-US) [ (en-US) <media-query-list> ] (en-US)? (en-US);

<media-query-list> = <media-query># (en-US)

<media-query> = <media-condition> | (en-US) [ (en-US) not | (en-US) only ] (en-US)? (en-US) <media-type> [ (en-US) and <media-condition-without-or> ] (en-US)? (en-US)

<media-condition> = <media-not> | (en-US) <media-and> | (en-US) <media-or> | (en-US) <media-in-parens>
<media-type> = <ident> (en-US)
<media-condition-without-or> = <media-not> | (en-US) <media-and> | (en-US) <media-in-parens>

<media-not> = not <media-in-parens>
<media-and> = <media-in-parens> [ (en-US) and <media-in-parens> ] (en-US)+ (en-US)
<media-or> = <media-in-parens> [ (en-US) or <media-in-parens> ] (en-US)+ (en-US)
<media-in-parens> = ( <media-condition> ) | (en-US) <media-feature> | (en-US) <general-enclosed>

<media-feature> = ( [ (en-US) <mf-plain> | (en-US) <mf-boolean> | (en-US) <mf-range> ] (en-US) )
<general-enclosed> = [ (en-US) <function-token> <any-value> ) ] (en-US) | (en-US) ( <ident> (en-US) <any-value> )

<mf-plain> = <mf-name> : <mf-value>
<mf-boolean> = <mf-name>
<mf-range> = <mf-name> [ (en-US) '<' | (en-US) '>' ] (en-US)? (en-US) '='? (en-US) <mf-value> | (en-US) <mf-value> [ (en-US) '<' | (en-US) '>' ] (en-US)? (en-US) '='? (en-US) <mf-name> | (en-US) <mf-value> '<' '='? (en-US) <mf-name> '<' '='? (en-US) <mf-value> | (en-US) <mf-value> '>' '='? (en-US) <mf-name> '>' '='? (en-US) <mf-value>

<mf-name> = <ident> (en-US)
<mf-value> = <number> (en-US) | (en-US) <dimension> | (en-US) <ident> (en-US) | (en-US) <ratio>


Specification Status Comment
CSS Cascading and Inheritance Level 3
The definition of '@import' in that specification.
Media Queries
The definition of '@import' in that specification.
Recommendation Extended the syntax to support any media query and not only simple media types.
CSS Level 2 (Revision 1)
The definition of '@import' in that specification.
Recommendation Added support for <string> (en-US) to denote the url of a stylesheet,
and requirement to insert the @import rule at the beginning of the CSS document.
CSS Level 1
The definition of '@import' in that specification.
Recommendation Initial definition

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help! (en-US)

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) (Yes) (Yes) 5.5 (Yes) (Yes)
Feature Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) (Yes) (Yes) 5.5 (Yes) (Yes)