How do you write a CSS selector when the class name is just an integer?

css, css-selectors

Solution

See this: Which characters are valid in CSS class names/selectors?

a (class) name must begin with an underscore (_), a dash (-), or a letter(a–z)

Problem

Let's say I have ``` <span class="1">hello</span> ``` And I want to declare: ``` span.1 { /* rules */ } ``` This does not seem to work (i.e. the CSS rule is not being applied.) Is there a way to get this to work? I tried just quoting the "1" in the CSS selector but that doesn't appear to be it.

Original source

Related problems