Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can XHTML and HTML class attributes value start with a number?

Tags:

html

xhtml

Can XHTML and HTML class attributes value start with a number?

like image 490
HELP Avatar asked Nov 03 '10 16:11

HELP


1 Answers

No. They have to be SGML names. They "must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

However, class names that start with a number are supported by IE.

EDIT: meder pointed out that you can use Unicode characters and they seem to work in all browsers. I don't know if it complies with the specifications, but it does seem to validate. See http://css-tricks.com/unicode-class-names/ and http://snook.ca/archives/html_and_css/unicode_for_css_class_names

like image 126
Adam Avatar answered Sep 16 '22 15:09

Adam