user-ident property CSS Reference



Definition and Usage

The <user-ident> CSS data value denotes an arbitrary user-defined string used as an identifier.

Its syntax is similar to the CSS identifier one, except that it is case-sensitive: a <user-ident> is a sequence of characters where characters can be:

  • any alphanumeric character (A to Z, or a to z),
  • any decimal digit (0 to 9),
  • a dash ('-')
  • an underscore ('_'),
  • a escaped character (with a backslash, '\'),
  • or a Unicode character (in the format of a backslash followed by one to six hexadecimal digits, its Unicode code point).

The first character must not be a decimal digit nor a dash ('-') followed by a decimal digit or another dash. A <user-ident> must not be placed between single or double quotes as it would be identical to a <string>.

Note that id1, Id1, iD1 and ID1 are all different identifiers as they are case-sensitive. In the opposite, as they are several way to escape a character, toto\? and toto\3F are the same identifiers.

These are 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 an alphabetic character
_internal         An underscore followed by alphanumeric characters
\22 toto          A Unicode character followed by a sequence of alphanumeric character
bili\.bob         The period is correctly escaped

These are invalid identifiers:

34rem             It must not start with a decimal digit.
-12rad            It must not start with a dash followed by a decimal digit.
bili.bob          Only alphanumeric characters, _ and - need not being escaped.
--toto            It must not start with two dashes.
'bilibob'         It isn't an <user-ident>, it is a <string>.
"bilibob"         It isn't an <user-ident>, it is a <string>.

The <user-ident> data type is mainly used in conjunction with CSS Counters, the counter functional notation and the two related CSS properties, counter-reset and counter-increment.


Compatibility

Desktop browsers

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 2.0 1.0 8.0 9.2 3.1

Mobile browsers

Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support NA NA NA NA NA

Relative articles