Mar
26
26
Don’t start your classes or IDs with a number
Might not be an obvious one for people approaching CSS from a design background rather than a programming one.
The browser will not pick up your styles if your element’s class or ID starts with a number.
If you’re wondering why the browser is ignoring the styles you’ve set, that might be why!
The same goes for hyphens and underscores, the only non-alphanumeric characters allowed in classes and IDs. The CSS spec states that hyphens and underscores should only be used for vendor-specific extensions (for example, if you’ve ever seen -moz-attribute used).
Tags: class, css, element, hyphen, ID, identifier, name, programming, start with a number, underscore






