At-Rules #

At-rules control how CSS behaves.

Statement at-rules end with a semicolon, while block at-rules end with curly braces.

Some at-rules use at-rule functions and descriptors.

Certain at-rules, such as @container, @layer, @media, @scope, @starting-style, and @supports, can be nested.

Statement At-Rules #

@import imports styles from other stylesheets.

@import must be at the top except @charset and @layer.

The @import at-rule with the layer keyword creates an anonymous layer.

The @import at-rule with the layer() function creates a named or anonymous layer.

@layer declares a cascade layer.

@layer creates one or more named layers as a statement at-rule.

@layer creates a named or anonymous layer as a block at-rule.

Block At-Rules #