Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a maximum length for the class name in CSS?

Tags:

css

Is there a maximum number of caracters for the name of a class in CSS ?

like image 821
Pierre Watelet Avatar asked Feb 03 '10 13:02

Pierre Watelet


People also ask

Can class name have space in CSS?

The class name can't contain a space, but it can contain hyphens or underscores. Any tag can have multiple space-separated class names.

What characters are allowed in CSS class names?

In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A0 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, two hyphens, or a hyphen followed by a digit.

Does CSS have a limit?

No , There won't be any limit.

Does class name matter in CSS?

No, it does not.


2 Answers

.thereisnomaximumlengthforaclassnameincss { maxlength: no; } 

Good luck! There is no maximum length it says.

like image 119
Younes Avatar answered Oct 08 '22 20:10

Younes


No maxiumum.

Basically, a name may start with an underscore (_), a dash (-), or a letter(a–z), and then be immediately followed by a letter, or underscore, and THEN have any number of dashes, underscores, letters, or numbers:

-?[_a-zA-Z]+[_a-zA-Z0-9-]* 
like image 25
Yada Avatar answered Oct 08 '22 19:10

Yada