The <ident> CSS data type denotes an arbitrary string used as an identifier.
On this page
<ident>
Syntax
The syntax of <custom-ident> is similar to CSS identifiers (such as property names), except that it is case-sensitive. It consists of one or more characters, where characters can be any of the following:
- any alphabetical character (
AtoZ, oratoz), - any decimal digit (
0to9), - a hyphen (
-), - an underscore (
_), - an escaped character (preceded by a backslash,
\), - a Unicode character (in the format of a backslash,
\, followed by one to six hexadecimal digits, representing its Unicode code point)
Note that id1, Id1, iD1 and ID1 are all different identifiers as they are case-sensitive. On the other hand, as there are several ways to escape a character, toto\? and toto\3F are the same identifiers.
Examples
Valid identifiers
nono79 A mix of alphanumeric characters and numbers
ground-level A mix of alphanumeric characters and a dash
-test A dash followed by alphanumeric characters
--toto A custom-property like identifier
_internal An underscore followed by alphanumeric characters
\22 toto A Unicode character followed by a sequence of alphanumeric characters
bili\.bob A correctly escaped period
Invalid identifiers
Specifications
| Specification |
|---|
| CSS Values and Units Module Level 4 # css-identifier |
Browser compatibility
See also
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/ident