CSS Reference ยท Units and Values
Custom identifiers
Reference for the CSS custom-ident type: author-chosen names used for keyframes, counters, grid areas, layers and containers, plus the naming rules.
A custom identifier (<custom-ident>) is a name that you invent and that CSS uses only as a label. Unlike keywords such as flex or bold, it has no built-in meaning; it just connects one part of your CSS to another. A @keyframes name matches an animation-name, a grid area name matches a grid-area, and a counter name ties counter-reset to counter-increment.
A close relative is the dashed identifier (<dashed-ident>), a custom identifier that must start with two hyphens, such as --accent or --card. It is used where the spec wants to avoid clashing with future keywords.
@keyframes pulse { to { opacity: 0.4; } } .dot { animation: pulse 1s infinite alternate; } .page { grid-template-areas: "head head" "side main"; } .side { grid-area: side; }
Try it
Syntax
<custom-ident> = an identifier that is not a CSS-wide keyword <dashed-ident> = an identifier that starts with --
Where a property needs a custom identifier, some extra words are also excluded. For instance, an animation name cannot be none, and a counter name cannot be none.
Values
| Use | Where the name appears |
|---|---|
| Animation | @keyframes name and animation-name |
| Counter | counter-reset, counter-increment, counter() |
| Grid | grid-template-areas, grid-area, named lines like [content-start] |
| Container | container-name and @container name (...) |
| Layer | @layer name |
| Custom property | --name (a dashed identifier) |
| Anchor and view transitions | anchor-name and view-transition-name use dashed or custom names |
| Counter style, font palette | @counter-style name, @font-palette-values --name |
Usage notes
- Never reuse a CSS-wide keyword.
initial,inherit,unset,revertandrevert-layerare not allowed as custom identifiers, anddefaultis reserved in several places. - Names are case-sensitive.
Pulseandpulseare different animations. - Spelling mistakes fail silently. If the name in
animation-namehas no matching@keyframes, nothing animates and nothing warns you. - Use meaningful, scoped names.
slide-inbeatsa1; a project prefix helps when stylesheets are combined. - Names are global to the scope. Two
@keyframeswith the same name in one stylesheet: the last one wins. - Not strings. Do not quote them. A few legacy places also accept a quoted name, but unquoted is the normal style.
Browser support
Custom identifiers are part of CSS itself and work wherever the feature that uses them works. Dashed identifiers in newer features, such as anchor positioning, depend on that feature's support; check a compatibility table.
Related
@keyframesโ animation namesgrid-areaโ grid area namescounter-resetโ counter names- strings and identifiers
- Lesson: Counters