CSS At-rules are directives that control how CSS should behave, including media queries, font definitions, and keyframe animations. Browse all 22 at-rules in our CSS Reference.
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.
97%Widely availableLets you style elements based on their container, the nearest ancestor set up as one, by its size or its custom property values rather than the whole viewport.
96%Widely availableLets you apply styles based on the value of a container's custom property, like @container style(--theme: dark), instead of only its size.
Snippet →88%Newly availableAn at-rule that lets you create your own custom numbering systems (like using emojis or Roman numerals) for list bullets and counters.
96%Widely availableAn experimental at-rule that lets you define reusable media queries (like '@custom-media --tablet (max-width: 768px)') for cleaner, more maintainable code.
2%Limited availabilityAllows 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.
97%Widely availableAn at-rule that lets you define custom aliases for OpenType font features, making your CSS easier to read when working with complex typography.
95%Widely availableAn 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.
96%Widely availableAn 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.
Snippet →70%Limited availabilityImports style rules from other style sheets. It must come before every other rule except @charset and @layer statements.
97%Widely availableDefines the steps of a CSS animation. You specify exactly which styles should change at specific points (0% to 100%) during the animation sequence.
97%Widely availableA 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.
96%Widely availableApplies styles only when certain conditions are met, such as specific screen widths, resolutions or user preferences like dark mode.
97%Widely availableUsed 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.
97%Widely availableAn 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.
95%Newly availableAn 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.
87%Newly availableThe @property at-rule allows you to register custom CSS variables with a specific data type and initial value. Because the browser knows the type, you can animate things that used to jump, like gradient colors.
96%Newly availableLimits a group of rules to a subtree. Selectors inside the block only match descendants of the scoped root, so short class names stay local.
Snippet →93%Newly availableAllows you to define the initial styles for an element for its 'entry' animation. It lets you animate elements (like modals or dropdowns) as they are added to the DOM without using JavaScript timeouts.
Snippet →93%Newly availableChecks for browser support of specific CSS features and applies styles only if those features are available.
97%Widely availableControls 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.
88%Limited availabilityA 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.
0%Limited availabilityNothing matches.