CSS At-Rules

CSS At-rules are directives that control how CSS should behave, including media queries, font definitions, and keyframe animations. Browse all 21 css at-rules in our CSS Reference.

@container

Availability Widely Available
Support
93%

Lets you style elements based on the attributes of their parent container (like its width) rather than the entire browser viewport.

@font-feature-values

Availability Widely Available
Support
92%

An at-rule that lets you define custom aliases for OpenType font features, making your CSS easier to read when working with complex typography.

@font-palette-values

Availability Widely Available
Support
94%

An at-rule that lets you define your own custom color palettes for a color font (like an icon font or emoji font) by overriding its default colors.

@layer

Availability Widely Available
Support
94%

A powerful way to organize your CSS into 'layers' of priority. It allows you to ensure that certain styles (like a theme) always override others (like a reset), regardless of selector specificity.

@media

Availability Widely Available
Support
96%

Applies styles only when certain conditions are met, such as specific screen widths, resolutions, or user preferences like dark mode.

@position-try

Availability Limited
Support
77%

An at-rule that allows you to define custom named sets of positioning properties. These can then be used as fallbacks in the 'position-try-fallbacks' property.

@property

Availability Newly Available
Support
94%

The @property at-rule allows you to register custom CSS variables with a specific data type and initial value. This is powerful because it allows you to animate things that were previously impossible, like gradients.

@scope

Availability Newly Available
Support
86%

The @scope at-rule allows you to limit the reach of your styles to a specific part of the page. This is a native alternative to things like 'CSS Modules' or 'Styled Components', letting you keep styles local without complex naming rules.

@starting-style

Availability Newly Available
Support
87%

Allows you to define the initial styles for an element for its 'entry' animation. This is a game-changer because it lets you animate elements (like modals or dropdowns) as they are added to the DOM without using JavaScript timeouts.

@supports

Availability Widely Available
Support
96%

Checks for browser support of specific CSS features and applies styles only if those features are available.

@view-transition

Availability Limited
Support
82%

Controls the browser's native view transition feature. It can be used to enable or disable transitions for specific elements or across the entire document during state changes.

Interop 2026 focus area

style()

Availability Limited
Support
0%

A part of container queries that lets you style elements based on the computed value of a CSS property (usually a custom property) on their parent container, rather than just size.

Interop 2026 focus area

@charset

Availability Widely Available
Support
96%

An at-rule used to define the character encoding of the CSS file. It must be at the very first line of the file and only one is allowed.

@counter-style

Availability Newly Available
Support
93%

An at-rule that lets you create your own custom numbering systems (like using emojis or Roman numerals) for list bullets and counters.

@custom-media

Availability Limited
Support
N/A

An experimental at-rule that lets you define reusable media queries (like '@custom-media --tablet (max-width: 768px)') for cleaner, more maintainable code.

@font-face

Availability Widely Available
Support
96%

Allows you to load custom fonts onto a webpage, so you aren't limited to the standard 'web-safe' fonts installed on a user's computer.

@function

Availability Limited
Support
67%

An experimental at-rule that lets you define your own custom CSS functions with logic and return values, very similar to functions in programming languages like JavaScript.

@import

Availability Widely Available
Support
96%

Allows you to import style rules from other style sheets. It must be placed at the very top of your CSS file.

@keyframes

Availability Widely Available
Support
96%

Defines the steps of a CSS animation. You specify exactly which styles should change at specific points (0% to 100%) during the animation sequence.

@namespace

Availability Widely Available
Support
96%

Used in CSS to handle XML documents that have multiple 'namespaces' (like SVG mixed with XHTML). It tells CSS which namespace a selector should belong to.

@page

Availability Newly Available
Support
93%

An at-rule used to apply styles specifically to printed pages. It lets you set things like page margins, size, and orientation for the whole document.

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC