docs.rodeo

MDN Web Docs mirror

At-rules

{{CSSRef}} 

At-rules are CSS statements that instruct CSS how to behave. They begin with an at-sign, @ (U+0040 COMMERCIAL AT), followed by an identifier. They include everything from the at-keyword up to the next semicolon, ; (U+003B SEMICOLON), or the next CSS block, whichever comes first.

At-rules are used to group and structure style rules and other at-rules, declare style information not directly associated with selected content, and manage syntactic constructs such as imports and namespaces keyword mappings.

Syntax

The at-rule is defined in the CSS syntax module, with different at-rules being defined in their respective modules. They generally take one of two forms depending on the specific rule and its purpose: statement at-rules and block at-rules, which can contain nested qualified rules, at-rules, or declarations.

Statement at-rules

/* General structure */
@identifier (RULE);

/* Example: tells browser to use UTF-8 character set */
@charset "utf-8";

Statement at-rules end in a semicolon. There are several statement at-rules, designated by their identifiers, each with a different syntax:

Block at-rules

@identifier (RULE) {
}

Block at-rules end in a {}-block that contain nested rules, other at-rules, or property or descriptor declarations.

Index

Specifications

{{Specifications}} 

See also

In this article

View on MDN