CSS class starting with number is not getting applied

For classes starting with numbers, you’ll need to write

.\32 00-200 {
  width: 200px;
  height: 200px;
}

You’ll probably want to avoid doing that.

The \32 represents the digit “2”. The space following it is necessary to terminate the escape sequence.

The reason for this is that “CSS identifiers” may not start with numbers. In CSS, class names used in selectors are considered “CSS identifiers”. Therefore, the leading number must be escaped in the way shown above. Note that there is no restriction from the HTML perspective on class names, other than they may not contain spaces. So you could write <div class="%^*+🍺&lt;", as long as you were willing to figure out how to write that in escaped form in your CSS file.

See the question suggested as a duplicate for more information.

Leave a Comment