CSS import rule one of CSS at-rule

suggest change

The @import CSS at-rule imports style rules from other style sheets. An @import must precede style rules. It may be preceded by @charset and by @layer statements. It is not a nested statement, so it cannot be placed inside a conditional group such as @media; put media conditions in the @import itself instead. See @import.

How to use @import

You can use the @import rule in the following ways:

A. With internal style tag

<style>
 @import url('/css/styles.css');
</style>

B. With external stylesheet

The following line imports a CSS file named additional-styles.css in the root directory into the CSS file in which it appears:

@import '/additional-styles.css';

Importing external CSS is also possible. A common use case is a font stylesheet.

@import 'https://fonts.googleapis.com/css?family=Lato';

An optional second argument to @import rule is a list of media queries:

@import '/print-styles.css' print;
@import url('landscape.css') screen and (orientation:landscape);

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents