Confur Quod
Confur Quod

Reputation: 31

Underscore in front of css class

While inspecting some part of css of facebook i've noticed some class like this "_5pcb _5tmf _5p3y _50f3". Does the underscore has any special use or just for aesthetic and readability? I'm aware that underscores and hypens are valid character but I'm just wondering if the underscore in the front has a special use

Upvotes: 0

Views: 610

Answers (2)

rajesh
rajesh

Reputation: 1485

Basically, a name must begin with an underscore (_), a hyphen (-), or a letter(a–z), followed by any number of hyphens, underscores, letters, or numbers. There is a catch: if the first character is a hyphen, the second character must be a letter or underscore, and the name must be at least 2 characters long.

-?[_a-zA-Z]+[_a-zA-Z0-9-]*

Note that, according to the CSS grammar, a rule starting with TWO hyphens, e.g. --className, is invalid.

Upvotes: 1

Thilo
Thilo

Reputation: 262554

The underscore itself has no special meaning (and I don't find it very aesthetic), but you cannot start class names with a digit, so it's probably just padding for that.

Upvotes: 1

Related Questions