at-rule
CSS @import
Loads rules from another stylesheet at the import position in the cascade. Place imports before style rules and most at-rules; the legacy encoding declaration and layer-order statements are exceptions. Layer and conditional syntax must be checked separately for support.
Formal Syntax & Structure
css syntaxcss
@import [ <url> | <string> ] [ layer | layer(<layer-name>) ]? [ supports([ <supports-condition> | <declaration> ]) ]? <media-query-list>? ;Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| resource | <url> | <string> | Stylesheet location. |
| layer | layer or layer(name) | Optional cascade layer. |
| supports | supports(condition) | Optional feature condition. |
| media | <media-query-list> | Optional media condition. |
Working Example
Example Snippetcss
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>CSS reference demo</title><style>@import url("theme.css");</style></head><body><p id="sample">A field note from the coast.</p></body></html>